forked from Ivasoft/mattermost-mobile
Ensure no unresolved types in the definition files (#6521)
* Ensure no unresolved types in the definition files * Address feedback and general cleanup * Move import from @constants/x to @constants where relevant * Remove unneeded "import as"
This commit is contained in:
committed by
GitHub
parent
aec0ccb105
commit
f4e6917185
@@ -6,7 +6,7 @@ import {Alert} from 'react-native';
|
||||
|
||||
import {showPermalink} from '@actions/remote/permalink';
|
||||
import {Client} from '@client/rest';
|
||||
import DeepLinkTypes from '@constants/deep_linking';
|
||||
import DeepLinkType from '@constants/deep_linking';
|
||||
import DatabaseManager from '@database/manager';
|
||||
import IntegrationsManager from '@managers/integrations_manager';
|
||||
import NetworkManager from '@managers/network_manager';
|
||||
@@ -140,17 +140,17 @@ export const handleGotoLocation = async (serverUrl: string, intl: IntlShape, loc
|
||||
|
||||
if (match && linkServerUrl) {
|
||||
switch (match.type) {
|
||||
case DeepLinkTypes.CHANNEL: {
|
||||
case DeepLinkType.Channel: {
|
||||
const data = match.data as DeepLinkChannel;
|
||||
switchToChannelByName(linkServerUrl, data.channelName, data.teamName, DraftUtils.errorBadChannel, intl);
|
||||
break;
|
||||
}
|
||||
case DeepLinkTypes.PERMALINK: {
|
||||
case DeepLinkType.Permalink: {
|
||||
const data = match.data as DeepLinkPermalink;
|
||||
showPermalink(linkServerUrl, data.teamName, data.postId, intl);
|
||||
break;
|
||||
}
|
||||
case DeepLinkTypes.DMCHANNEL: {
|
||||
case DeepLinkType.DirectMessage: {
|
||||
const data = match.data as DeepLinkDM;
|
||||
if (!data.userName) {
|
||||
DraftUtils.errorUnkownUser(intl);
|
||||
@@ -171,7 +171,7 @@ export const handleGotoLocation = async (serverUrl: string, intl: IntlShape, loc
|
||||
makeDirectChannel(linkServerUrl, user.id, displayUsername(user, intl.locale, await getTeammateNameDisplay(database)), true);
|
||||
break;
|
||||
}
|
||||
case DeepLinkTypes.GROUPCHANNEL: {
|
||||
case DeepLinkType.GroupMessage: {
|
||||
const data = match.data as DeepLinkGM;
|
||||
if (!data.channelId) {
|
||||
DraftUtils.errorBadChannel(intl);
|
||||
@@ -181,7 +181,7 @@ export const handleGotoLocation = async (serverUrl: string, intl: IntlShape, loc
|
||||
switchToChannelById(linkServerUrl, data.channelId);
|
||||
break;
|
||||
}
|
||||
case DeepLinkTypes.PLUGIN: {
|
||||
case DeepLinkType.Plugin: {
|
||||
const data = match.data as DeepLinkPlugin;
|
||||
showModal('PluginInternal', data.id, {link: location});
|
||||
break;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {getChannelById} from '@app/queries/servers/channel';
|
||||
import {Client} from '@client/rest';
|
||||
import DatabaseManager from '@database/manager';
|
||||
import NetworkManager from '@managers/network_manager';
|
||||
import {getChannelById} from '@queries/servers/channel';
|
||||
import {getTeamById} from '@queries/servers/team';
|
||||
|
||||
import {forceLogoutIfNecessary} from './session';
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
|
||||
import {DeviceEventEmitter} from 'react-native';
|
||||
|
||||
import {Events} from '@constants';
|
||||
import Calls from '@constants/calls';
|
||||
import {Events, Calls} from '@constants';
|
||||
import {t} from '@i18n';
|
||||
import {setServerCredentials} from '@init/credentials';
|
||||
import {Analytics, create} from '@managers/analytics';
|
||||
|
||||
@@ -12,13 +12,14 @@ import {COMMAND_SUGGESTION_CHANNEL, COMMAND_SUGGESTION_USER} from '@constants/ap
|
||||
import {useServerUrl} from '@context/server';
|
||||
import {useTheme} from '@context/theme';
|
||||
import analytics from '@managers/analytics';
|
||||
import ChannelModel from '@typings/database/models/servers/channel';
|
||||
import UserModel from '@typings/database/models/servers/user';
|
||||
import {makeStyleSheetFromTheme} from '@utils/theme';
|
||||
|
||||
import {AppCommandParser, ExtendedAutocompleteSuggestion} from '../app_command_parser/app_command_parser';
|
||||
import SlashSuggestionItem from '../slash_suggestion_item';
|
||||
|
||||
import type ChannelModel from '@typings/database/models/servers/channel';
|
||||
import type UserModel from '@typings/database/models/servers/user';
|
||||
|
||||
export type Props = {
|
||||
currentTeamId: string;
|
||||
isSearch?: boolean;
|
||||
|
||||
@@ -13,12 +13,12 @@ import {withServerUrl} from '@context/server';
|
||||
import {observeMyChannel} from '@queries/servers/channel';
|
||||
import {queryDraft} from '@queries/servers/drafts';
|
||||
import {observeCurrentChannelId, observeCurrentUserId} from '@queries/servers/system';
|
||||
import ChannelModel from '@typings/database/models/servers/channel';
|
||||
import MyChannelModel from '@typings/database/models/servers/my_channel';
|
||||
|
||||
import ChannelItem from './channel_item';
|
||||
|
||||
import type {WithDatabaseArgs} from '@typings/database/database';
|
||||
import type ChannelModel from '@typings/database/models/servers/channel';
|
||||
import type MyChannelModel from '@typings/database/models/servers/my_channel';
|
||||
|
||||
type EnhanceProps = WithDatabaseArgs & {
|
||||
channel: ChannelModel;
|
||||
|
||||
@@ -31,6 +31,8 @@ import {getMarkdownImageSize} from '@utils/markdown';
|
||||
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
||||
import {normalizeProtocol, tryOpenURL} from '@utils/url';
|
||||
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type MarkdownImageProps = {
|
||||
disabled?: boolean;
|
||||
errorTextStyle: StyleProp<TextStyle>;
|
||||
|
||||
@@ -12,7 +12,7 @@ import urlParse from 'url-parse';
|
||||
import {switchToChannelByName} from '@actions/remote/channel';
|
||||
import {showPermalink} from '@actions/remote/permalink';
|
||||
import SlideUpPanelItem, {ITEM_HEIGHT} from '@components/slide_up_panel_item';
|
||||
import DeepLinkTypes from '@constants/deep_linking';
|
||||
import DeepLinkType from '@constants/deep_linking';
|
||||
import {useServerUrl} from '@context/server';
|
||||
import {useTheme} from '@context/theme';
|
||||
import {bottomSheet, dismissBottomSheet} from '@screens/navigation';
|
||||
@@ -68,9 +68,9 @@ const MarkdownLink = ({children, experimentalNormalizeMarkdownLinks, href, siteU
|
||||
const match: DeepLinkWithData | null = matchDeepLink(url, serverUrl, siteURL);
|
||||
|
||||
if (match && match.data?.teamName) {
|
||||
if (match.type === DeepLinkTypes.CHANNEL) {
|
||||
if (match.type === DeepLinkType.Channel) {
|
||||
await switchToChannelByName(serverUrl, (match?.data as DeepLinkChannel).channelName, match.data?.teamName, errorBadChannel, intl);
|
||||
} else if (match.type === DeepLinkTypes.PERMALINK) {
|
||||
} else if (match.type === DeepLinkType.Permalink) {
|
||||
showPermalink(serverUrl, match.data.teamName, (match.data as DeepLinkPermalink).postId, intl);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -8,8 +8,7 @@ import LinearGradient from 'react-native-linear-gradient';
|
||||
|
||||
import CompassIcon from '@components/compass_icon';
|
||||
import {CELL_MAX_WIDTH, CELL_MIN_WIDTH} from '@components/markdown/markdown_table_cell';
|
||||
import {Screens} from '@constants';
|
||||
import DeviceTypes from '@constants/device';
|
||||
import {Screens, Device} from '@constants';
|
||||
import {goToScreen} from '@screens/navigation';
|
||||
import {preventDoubleTap} from '@utils/tap';
|
||||
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
||||
@@ -182,7 +181,7 @@ class MarkdownTable extends PureComponent<MarkdownTableProps, MarkdownTableState
|
||||
|
||||
// render as flex in the channel screen, only for mobile phones on the portrait mode,
|
||||
// and if tables have 2 ~ 4 columns
|
||||
if (!isFullView && numColumns > 1 && numColumns < 4 && !DeviceTypes.IS_TABLET) {
|
||||
if (!isFullView && numColumns > 1 && numColumns < 4 && !Device.IS_TABLET) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -194,7 +193,7 @@ class MarkdownTable extends PureComponent<MarkdownTableProps, MarkdownTableState
|
||||
|
||||
// render as flex in full table screen, only for mobile phones on portrait mode,
|
||||
// and if tables have 3 or 4 columns
|
||||
if (isFullView && numColumns >= 3 && numColumns <= 4 && !DeviceTypes.IS_TABLET) {
|
||||
if (isFullView && numColumns >= 3 && numColumns <= 4 && !Device.IS_TABLET) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import {fileToGalleryItem, openGalleryAtIndex} from '@utils/gallery';
|
||||
import {generateId} from '@utils/general';
|
||||
import {calculateDimensions, isGifTooLarge} from '@utils/images';
|
||||
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type MarkdownTableImageProps = {
|
||||
disabled?: boolean;
|
||||
imagesMetadata: Record<string, PostImage>;
|
||||
|
||||
@@ -12,10 +12,10 @@ import AutocompleteSelector from '@components/autocomplete_selector';
|
||||
import {AppBindingLocations, AppCallResponseTypes} from '@constants/apps';
|
||||
import {useServerUrl} from '@context/server';
|
||||
import {observeCurrentTeamId} from '@queries/servers/system';
|
||||
import {WithDatabaseArgs} from '@typings/database/database';
|
||||
import {createCallContext} from '@utils/apps';
|
||||
import {logDebug} from '@utils/log';
|
||||
|
||||
import type {WithDatabaseArgs} from '@typings/database/database';
|
||||
import type ChannelModel from '@typings/database/models/servers/channel';
|
||||
import type PostModel from '@typings/database/models/servers/post';
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ import {calculateDimensions, getViewPortWidth, isGifTooLarge} from '@utils/image
|
||||
import {changeOpacity} from '@utils/theme';
|
||||
import {extractFilenameFromUrl, isImageLink, isValidUrl} from '@utils/url';
|
||||
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type ImagePreviewProps = {
|
||||
expandedLink?: string;
|
||||
isReplyPost: boolean;
|
||||
|
||||
@@ -17,6 +17,8 @@ import {isGifTooLarge, calculateDimensions, getViewPortWidth} from '@utils/image
|
||||
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
||||
import {extractFilenameFromUrl, isValidUrl} from '@utils/url';
|
||||
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
|
||||
return {
|
||||
attachmentMargin: {
|
||||
|
||||
@@ -17,6 +17,8 @@ import {BestImage, getNearestPoint} from '@utils/opengraph';
|
||||
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
||||
import {extractFilenameFromUrl, isValidUrl} from '@utils/url';
|
||||
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type OpengraphImageProps = {
|
||||
isReplyPost: boolean;
|
||||
layoutWidth?: number;
|
||||
|
||||
@@ -73,6 +73,18 @@ export const GLOBAL_IDENTIFIERS = {
|
||||
PROFILE_LONG_PRESS_TUTORIAL: 'profileLongPressTutorial',
|
||||
};
|
||||
|
||||
export enum OperationType {
|
||||
CREATE = 'CREATE',
|
||||
UPDATE = 'UPDATE',
|
||||
DELETE = 'DELETE',
|
||||
}
|
||||
|
||||
// The only two types of databases in the app
|
||||
export enum DatabaseType {
|
||||
DEFAULT,
|
||||
SERVER,
|
||||
}
|
||||
|
||||
export default {
|
||||
GLOBAL_IDENTIFIERS,
|
||||
MM_TABLES,
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
export default {
|
||||
CHANNEL: 'channel',
|
||||
DMCHANNEL: 'dmchannel',
|
||||
GROUPCHANNEL: 'groupchannel',
|
||||
PERMALINK: 'permalink',
|
||||
PLUGIN: 'plugin',
|
||||
OTHER: 'other',
|
||||
};
|
||||
const DeepLinkType = {
|
||||
Channel: 'channel',
|
||||
DirectMessage: 'dm',
|
||||
GroupMessage: 'gm',
|
||||
Invalid: 'invalid',
|
||||
Permalink: 'permalink',
|
||||
Plugin: 'plugin',
|
||||
} as const;
|
||||
|
||||
export default DeepLinkType;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
import ActionType from './action_type';
|
||||
import Apps from './apps';
|
||||
import Calls from './calls';
|
||||
import Categories from './categories';
|
||||
import Channel from './channel';
|
||||
import Config from './config';
|
||||
@@ -15,6 +16,7 @@ import Events from './events';
|
||||
import Files from './files';
|
||||
import General from './general';
|
||||
import Integrations from './integrations';
|
||||
import Launch from './launch';
|
||||
import List from './list';
|
||||
import Navigation from './navigation';
|
||||
import Network from './network';
|
||||
@@ -36,6 +38,7 @@ import WebsocketEvents from './websocket';
|
||||
export {
|
||||
ActionType,
|
||||
Apps,
|
||||
Calls,
|
||||
Categories,
|
||||
Channel,
|
||||
Config,
|
||||
@@ -48,6 +51,7 @@ export {
|
||||
Files,
|
||||
General,
|
||||
Integrations,
|
||||
Launch,
|
||||
List,
|
||||
Navigation,
|
||||
Network,
|
||||
|
||||
12
app/constants/launch.ts
Normal file
12
app/constants/launch.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
const LaunchType = {
|
||||
AddServer: 'add-server',
|
||||
Normal: 'normal',
|
||||
DeepLink: 'deeplink',
|
||||
Notification: 'notification',
|
||||
Upgrade: 'upgrade',
|
||||
} as const;
|
||||
|
||||
export default LaunchType;
|
||||
@@ -4,6 +4,8 @@
|
||||
import React, {useEffect, useLayoutEffect} from 'react';
|
||||
import Animated, {makeMutable, runOnUI} from 'react-native-reanimated';
|
||||
|
||||
import type {GalleryManagerSharedValues} from '@typings/screens/gallery';
|
||||
|
||||
export interface GalleryManagerItem {
|
||||
index: number;
|
||||
ref: React.RefObject<unknown>;
|
||||
|
||||
@@ -7,7 +7,7 @@ import logger from '@nozbe/watermelondb/utils/common/logger';
|
||||
import {DeviceEventEmitter, Platform} from 'react-native';
|
||||
import FileSystem from 'react-native-fs';
|
||||
|
||||
import {MIGRATION_EVENTS, MM_TABLES} from '@constants/database';
|
||||
import {DatabaseType, MIGRATION_EVENTS, MM_TABLES} from '@constants/database';
|
||||
import AppDatabaseMigrations from '@database/migration/app';
|
||||
import ServerDatabaseMigrations from '@database/migration/server';
|
||||
import {InfoModel, GlobalModel, ServersModel} from '@database/models/app';
|
||||
@@ -22,7 +22,6 @@ import ServerDataOperator from '@database/operator/server_data_operator';
|
||||
import {schema as appSchema} from '@database/schema/app';
|
||||
import {serverSchema} from '@database/schema/server';
|
||||
import {queryActiveServer, queryServer, queryServerByIdentifier} from '@queries/app/servers';
|
||||
import {DatabaseType} from '@typings/database/enums';
|
||||
import {deleteIOSDatabase} from '@utils/mattermost_managed';
|
||||
import {hashCode} from '@utils/security';
|
||||
import {removeProtocol} from '@utils/url';
|
||||
|
||||
@@ -8,7 +8,7 @@ import {DeviceEventEmitter, Platform} from 'react-native';
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
import FileSystem from 'react-native-fs';
|
||||
|
||||
import {MIGRATION_EVENTS, MM_TABLES} from '@constants/database';
|
||||
import {DatabaseType, MIGRATION_EVENTS, MM_TABLES} from '@constants/database';
|
||||
import AppDatabaseMigrations from '@database/migration/app';
|
||||
import ServerDatabaseMigrations from '@database/migration/server';
|
||||
import {InfoModel, GlobalModel, ServersModel} from '@database/models/app';
|
||||
@@ -23,7 +23,6 @@ import ServerDataOperator from '@database/operator/server_data_operator';
|
||||
import {schema as appSchema} from '@database/schema/app';
|
||||
import {serverSchema} from '@database/schema/server';
|
||||
import {queryActiveServer, queryServer, queryServerByIdentifier} from '@queries/app/servers';
|
||||
import {DatabaseType} from '@typings/database/enums';
|
||||
import {emptyFunction} from '@utils/general';
|
||||
import {logDebug, logError} from '@utils/log';
|
||||
import {deleteIOSDatabase, getIOSAppGroupDetails} from '@utils/mattermost_managed';
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
import {Q} from '@nozbe/watermelondb';
|
||||
import {Platform} from 'react-native';
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {DatabaseType} from '@typings/database/enums';
|
||||
import {DatabaseType, MM_TABLES} from '@constants/database';
|
||||
import {getIOSAppGroupDetails} from '@utils/mattermost_managed';
|
||||
|
||||
import DatabaseManager from './index';
|
||||
|
||||
@@ -5,7 +5,8 @@ import {Model} from '@nozbe/watermelondb';
|
||||
import {field} from '@nozbe/watermelondb/decorators';
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import InfoModelInterface from '@typings/database/models/app/info';
|
||||
|
||||
import type InfoModelInterface from '@typings/database/models/app/info';
|
||||
|
||||
const {INFO} = MM_TABLES.APP;
|
||||
|
||||
|
||||
@@ -6,10 +6,10 @@ import {field, immutableRelation} from '@nozbe/watermelondb/decorators';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import MyChannelSettingsModel from '@typings/database/models/servers/my_channel_settings';
|
||||
|
||||
import type ChannelModel from '@typings/database/models/servers/channel';
|
||||
import type MyChannelModelInterface from '@typings/database/models/servers/my_channel';
|
||||
import type MyChannelSettingsModel from '@typings/database/models/servers/my_channel_settings';
|
||||
|
||||
const {CATEGORY_CHANNEL, CHANNEL, MY_CHANNEL, MY_CHANNEL_SETTINGS} = MM_TABLES.SERVER;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import {children, field, json} from '@nozbe/watermelondb/decorators';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import ThreadParticipantsModel from '@typings/database/models/servers/thread_participant';
|
||||
import {safeParseJSON} from '@utils/helpers';
|
||||
|
||||
import type ChannelModel from '@typings/database/models/servers/channel';
|
||||
@@ -15,6 +14,7 @@ import type PostModel from '@typings/database/models/servers/post';
|
||||
import type PreferenceModel from '@typings/database/models/servers/preference';
|
||||
import type ReactionModel from '@typings/database/models/servers/reaction';
|
||||
import type TeamMembershipModel from '@typings/database/models/servers/team_membership';
|
||||
import type ThreadParticipantsModel from '@typings/database/models/servers/thread_participant';
|
||||
import type UserModelInterface from '@typings/database/models/servers/user';
|
||||
import type {UserMentionKey} from '@typings/global/markdown';
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {MM_TABLES, OperationType} from '@constants/database';
|
||||
import {prepareBaseRecord} from '@database/operator/server_data_operator/transformers';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
import type {Model} from '@nozbe/watermelondb';
|
||||
import type {TransformerArgs} from '@typings/database/database';
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {OperationType} from '@constants/database';
|
||||
import DatabaseManager from '@database/manager';
|
||||
import {
|
||||
transformInfoRecord,
|
||||
transformGlobalRecord,
|
||||
} from '@database/operator/app_data_operator/transformers/index';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
describe('** APP DATA TRANSFORMER **', () => {
|
||||
beforeAll(async () => {
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
import {Database, Q} from '@nozbe/watermelondb';
|
||||
|
||||
import {OperationType} from '@constants/database';
|
||||
import {
|
||||
getRangeOfValues,
|
||||
getValidRecordsForUpdate,
|
||||
retrieveRecords,
|
||||
} from '@database/operator/utils/general';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
import {logWarning} from '@utils/log';
|
||||
|
||||
import type {WriterInterface} from '@nozbe/watermelondb/Database';
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
} from '@database/operator/server_data_operator/transformers/general';
|
||||
|
||||
import type ServerDataOperator from '..';
|
||||
import type {Model} from '@nozbe/watermelondb';
|
||||
|
||||
describe('*** DataOperator: Base Handlers tests ***', () => {
|
||||
let operator: ServerDataOperator;
|
||||
@@ -104,13 +103,11 @@ describe('*** DataOperator: Base Handlers tests ***', () => {
|
||||
expect(appDatabase).toBeTruthy();
|
||||
expect(appOperator).toBeTruthy();
|
||||
|
||||
const transformer = async (model: Model) => model;
|
||||
|
||||
await expect(
|
||||
operator?.handleRecords({
|
||||
fieldName: 'invalidField',
|
||||
tableName: 'INVALID_TABLE_NAME',
|
||||
transformer,
|
||||
transformer: transformSystemRecord,
|
||||
createOrUpdateRawValues: [{id: 'tos-1', value: '1'}],
|
||||
prepareRecordsOnly: false,
|
||||
}),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {OperationType} from '@constants/database';
|
||||
import {
|
||||
transformCategoryRecord,
|
||||
transformCategoryChannelRecord,
|
||||
} from '@database/operator/server_data_operator/transformers/category';
|
||||
import {createTestConnection} from '@database/operator/utils/create_test_connection';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
describe('*** CATEGORY Prepare Records Test ***', () => {
|
||||
it('=> transformCategoryRecord: should return an array of type CategoryModel', async () => {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {MM_TABLES, OperationType} from '@constants/database';
|
||||
import {prepareBaseRecord} from '@database/operator/server_data_operator/transformers/index';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
import type {TransformerArgs} from '@typings/database/database';
|
||||
import type CategoryModel from '@typings/database/models/servers/category';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {OperationType} from '@constants/database';
|
||||
import {
|
||||
transformChannelInfoRecord,
|
||||
transformChannelRecord,
|
||||
@@ -9,7 +10,6 @@ import {
|
||||
transformChannelMembershipRecord,
|
||||
} from '@database/operator/server_data_operator/transformers/channel';
|
||||
import {createTestConnection} from '@database/operator/utils/create_test_connection';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
describe('*** CHANNEL Prepare Records Test ***', () => {
|
||||
it('=> transformChannelRecord: should return an array of type Channel', async () => {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {MM_TABLES, OperationType} from '@constants/database';
|
||||
import {prepareBaseRecord} from '@database/operator/server_data_operator/transformers/index';
|
||||
import {extractChannelDisplayName} from '@helpers/database';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
import type {TransformerArgs} from '@typings/database/database';
|
||||
import type ChannelModel from '@typings/database/models/servers/channel';
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {OperationType} from '@constants/database';
|
||||
import {
|
||||
transformCustomEmojiRecord,
|
||||
transformRoleRecord,
|
||||
transformSystemRecord,
|
||||
} from '@database/operator/server_data_operator/transformers/general';
|
||||
import {createTestConnection} from '@database/operator/utils/create_test_connection';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
describe('*** Role Prepare Records Test ***', () => {
|
||||
it('=> transformRoleRecord: should return an array of type Role', async () => {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {MM_TABLES, OperationType} from '@constants/database';
|
||||
import {prepareBaseRecord} from '@database/operator/server_data_operator/transformers/index';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
import type {TransformerArgs} from '@typings/database/database';
|
||||
import type CustomEmojiModel from '@typings/database/models/servers/custom_emoji';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {OperationType} from '@constants/database';
|
||||
import {transformGroupRecord} from '@database/operator/server_data_operator/transformers/group';
|
||||
import {createTestConnection} from '@database/operator/utils/create_test_connection';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
describe('*** GROUP Prepare Records Test ***', () => {
|
||||
it('=> transformGroupRecord: should return an array of type GroupModel', async () => {
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
// See LICENSE.txt for license information.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {MM_TABLES, OperationType} from '@constants/database';
|
||||
import {prepareBaseRecord} from '@database/operator/server_data_operator/transformers/index';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
import {generateGroupAssociationId} from '@utils/groups';
|
||||
|
||||
import type {TransformerArgs} from '@typings/database/database';
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
|
||||
import Model from '@nozbe/watermelondb/Model';
|
||||
|
||||
import {TransformerArgs} from '@typings/database/database';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
import {OperationType} from '@constants/database';
|
||||
|
||||
import type {TransformerArgs} from '@typings/database/database';
|
||||
|
||||
/**
|
||||
* prepareBaseRecord: This is the last step for each operator and depending on the 'action', it will either prepare an
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {OperationType} from '@constants/database';
|
||||
import {
|
||||
transformDraftRecord,
|
||||
transformFileRecord,
|
||||
@@ -9,7 +10,6 @@ import {
|
||||
transformPostsInChannelRecord,
|
||||
} from '@database/operator/server_data_operator/transformers/post';
|
||||
import {createTestConnection} from '@database/operator/utils/create_test_connection';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
describe('*** POST Prepare Records Test ***', () => {
|
||||
it('=> transformPostRecord: should return an array of type Post', async () => {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {MM_TABLES, OperationType} from '@constants/database';
|
||||
import {prepareBaseRecord} from '@database/operator/server_data_operator/transformers/index';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
import type{TransformerArgs} from '@typings/database/database';
|
||||
import type DraftModel from '@typings/database/models/servers/draft';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {OperationType} from '@constants/database';
|
||||
import {transformReactionRecord} from '@database/operator/server_data_operator/transformers/reaction';
|
||||
import {createTestConnection} from '@database/operator/utils/create_test_connection';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
describe('*** REACTION Prepare Records Test ***', () => {
|
||||
it('=> transformReactionRecord: should return an array of type Reaction', async () => {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {MM_TABLES, OperationType} from '@constants/database';
|
||||
import {prepareBaseRecord} from '@database/operator/server_data_operator/transformers/index';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
import type {TransformerArgs} from '@typings/database/database';
|
||||
import type ReactionModel from '@typings/database/models/servers/reaction';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {OperationType} from '@constants/database';
|
||||
import {
|
||||
transformMyTeamRecord,
|
||||
transformTeamChannelHistoryRecord,
|
||||
@@ -9,7 +10,6 @@ import {
|
||||
transformTeamSearchHistoryRecord,
|
||||
} from '@database/operator/server_data_operator/transformers/team';
|
||||
import {createTestConnection} from '@database/operator/utils/create_test_connection';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
describe('*** TEAM Prepare Records Test ***', () => {
|
||||
it('=> transformMyTeamRecord: should return an array of type MyTeam', async () => {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {MM_TABLES, OperationType} from '@constants/database';
|
||||
import {prepareBaseRecord} from '@database/operator/server_data_operator/transformers/index';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
import type {TransformerArgs} from '@typings/database/database';
|
||||
import type MyTeamModel from '@typings/database/models/servers/my_team';
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {MM_TABLES, OperationType} from '@constants/database';
|
||||
import {prepareBaseRecord} from '@database/operator/server_data_operator/transformers/index';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
import type {TransformerArgs} from '@typings/database/database';
|
||||
import type ThreadModel from '@typings/database/models/servers/thread';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {OperationType} from '@constants/database';
|
||||
import {transformPreferenceRecord, transformUserRecord} from '@database/operator/server_data_operator/transformers/user';
|
||||
import {createTestConnection} from '@database/operator/utils/create_test_connection';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
describe('*** USER Prepare Records Test ***', () => {
|
||||
it('=> transformPreferenceRecord: should return an array of type Preference', async () => {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {MM_TABLES} from '@constants/database';
|
||||
import {MM_TABLES, OperationType} from '@constants/database';
|
||||
import {prepareBaseRecord} from '@database/operator/server_data_operator/transformers/index';
|
||||
import {OperationType} from '@typings/database/enums';
|
||||
|
||||
import type {TransformerArgs} from '@typings/database/database';
|
||||
import type PreferenceModel from '@typings/database/models/servers/preference';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {DatabaseType} from '@constants/database';
|
||||
import DatabaseManager from '@database/manager';
|
||||
import {DatabaseType} from '@typings/database/enums';
|
||||
|
||||
export const createTestConnection = async ({databaseName = 'db_name', setActive = false}) => {
|
||||
const serverUrl = 'https://appv2.mattermost.com';
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {DEFAULT_LOCALE} from '@i18n';
|
||||
import TeamModel from '@typings/database/models/servers/team';
|
||||
|
||||
import type TeamModel from '@typings/database/models/servers/team';
|
||||
|
||||
export const selectDefaultTeam = (teams: Array<Team | TeamModel>, locale = DEFAULT_LOCALE, userTeamOrderPreference = '', primaryTeam = '') => {
|
||||
let defaultTeam;
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
|
||||
import {useGallery} from '@context/gallery';
|
||||
|
||||
import type {Context, GestureHandlers, OnGestureEvent} from '@typings/screens/gallery';
|
||||
import type {GestureHandlerGestureEvent} from 'react-native-gesture-handler';
|
||||
|
||||
function useRemoteContext<T extends object>(initialValue: T) {
|
||||
|
||||
@@ -9,8 +9,6 @@ import * as analytics from '@managers/analytics';
|
||||
import {logWarning} from '@utils/log';
|
||||
import {getIOSAppGroupDetails} from '@utils/mattermost_managed';
|
||||
|
||||
import type {ServerCredential} from '@typings/credentials';
|
||||
|
||||
export const getAllServerCredentials = async (): Promise<ServerCredential[]> => {
|
||||
const serverCredentials: ServerCredential[] = [];
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import {Alert, Linking, Platform} from 'react-native';
|
||||
import {Notifications} from 'react-native-notifications';
|
||||
|
||||
import {appEntry, pushNotificationEntry, upgradeEntry} from '@actions/remote/entry';
|
||||
import {Screens} from '@constants';
|
||||
import {Screens, DeepLink, Launch} from '@constants';
|
||||
import DatabaseManager from '@database/manager';
|
||||
import {getActiveServerUrl, getServerCredentials, removeServerCredentials} from '@init/credentials';
|
||||
import {getThemeForCurrentTeam} from '@queries/servers/preference';
|
||||
@@ -14,11 +14,12 @@ import {getCurrentUserId} from '@queries/servers/system';
|
||||
import {queryMyTeams} from '@queries/servers/team';
|
||||
import {goToScreen, resetToHome, resetToSelectServer, resetToTeams} from '@screens/navigation';
|
||||
import EphemeralStore from '@store/ephemeral_store';
|
||||
import {DeepLinkChannel, DeepLinkDM, DeepLinkGM, DeepLinkPermalink, DeepLinkType, DeepLinkWithData, LaunchProps, LaunchType} from '@typings/launch';
|
||||
import {logInfo} from '@utils/log';
|
||||
import {convertToNotificationData} from '@utils/notification';
|
||||
import {parseDeepLink} from '@utils/url';
|
||||
|
||||
import type {DeepLinkChannel, DeepLinkDM, DeepLinkGM, DeepLinkPermalink, DeepLinkWithData, LaunchProps} from '@typings/launch';
|
||||
|
||||
export const initialLaunch = async () => {
|
||||
const deepLinkUrl = await Linking.getInitialURL();
|
||||
if (deepLinkUrl) {
|
||||
@@ -42,7 +43,7 @@ export const initialLaunch = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
launchApp({launchType: LaunchType.Normal});
|
||||
launchApp({launchType: Launch.Normal});
|
||||
};
|
||||
|
||||
const launchAppFromDeepLink = (deepLinkUrl: string) => {
|
||||
@@ -58,13 +59,13 @@ const launchAppFromNotification = async (notification: NotificationWithData) =>
|
||||
const launchApp = async (props: LaunchProps, resetNavigation = true) => {
|
||||
let serverUrl: string | undefined;
|
||||
switch (props?.launchType) {
|
||||
case LaunchType.DeepLink:
|
||||
if (props.extra?.type !== DeepLinkType.Invalid) {
|
||||
case Launch.DeepLink:
|
||||
if (props.extra?.type !== DeepLink.Invalid) {
|
||||
const extra = props.extra as DeepLinkWithData;
|
||||
serverUrl = extra.data?.serverUrl;
|
||||
}
|
||||
break;
|
||||
case LaunchType.Notification: {
|
||||
case Launch.Notification: {
|
||||
serverUrl = props.serverUrl;
|
||||
break;
|
||||
}
|
||||
@@ -91,8 +92,8 @@ const launchApp = async (props: LaunchProps, resetNavigation = true) => {
|
||||
let launchType = props.launchType;
|
||||
if (!hasCurrentUser) {
|
||||
// migrating from v1
|
||||
if (launchType === LaunchType.Normal) {
|
||||
launchType = LaunchType.Upgrade;
|
||||
if (launchType === Launch.Normal) {
|
||||
launchType = Launch.Upgrade;
|
||||
}
|
||||
|
||||
const result = await upgradeEntry(serverUrl);
|
||||
@@ -126,11 +127,11 @@ const launchToHome = async (props: LaunchProps) => {
|
||||
let openPushNotification = false;
|
||||
|
||||
switch (props.launchType) {
|
||||
case LaunchType.DeepLink:
|
||||
case Launch.DeepLink:
|
||||
// TODO:
|
||||
// deepLinkEntry({props.serverUrl, props.extra});
|
||||
break;
|
||||
case LaunchType.Notification: {
|
||||
case Launch.Notification: {
|
||||
const extra = props.extra as NotificationWithData;
|
||||
openPushNotification = Boolean(props.serverUrl && !props.launchError && extra.userInteraction && extra.payload?.channel_id && !extra.payload?.userInfo?.local);
|
||||
if (openPushNotification) {
|
||||
@@ -140,7 +141,7 @@ const launchToHome = async (props: LaunchProps) => {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LaunchType.Normal:
|
||||
case Launch.Normal:
|
||||
appEntry(props.serverUrl!);
|
||||
break;
|
||||
}
|
||||
@@ -179,29 +180,29 @@ export const relaunchApp = (props: LaunchProps, resetNavigation = false) => {
|
||||
export const getLaunchPropsFromDeepLink = (deepLinkUrl: string): LaunchProps => {
|
||||
const parsed = parseDeepLink(deepLinkUrl);
|
||||
const launchProps: LaunchProps = {
|
||||
launchType: LaunchType.DeepLink,
|
||||
launchType: Launch.DeepLink,
|
||||
};
|
||||
|
||||
switch (parsed.type) {
|
||||
case DeepLinkType.Invalid:
|
||||
case DeepLink.Invalid:
|
||||
launchProps.launchError = true;
|
||||
break;
|
||||
case DeepLinkType.Channel: {
|
||||
case DeepLink.Channel: {
|
||||
const parsedData = parsed.data as DeepLinkChannel;
|
||||
(launchProps.extra as DeepLinkWithData).data = parsedData;
|
||||
break;
|
||||
}
|
||||
case DeepLinkType.DirectMessage: {
|
||||
case DeepLink.DirectMessage: {
|
||||
const parsedData = parsed.data as DeepLinkDM;
|
||||
(launchProps.extra as DeepLinkWithData).data = parsedData;
|
||||
break;
|
||||
}
|
||||
case DeepLinkType.GroupMessage: {
|
||||
case DeepLink.GroupMessage: {
|
||||
const parsedData = parsed.data as DeepLinkGM;
|
||||
(launchProps.extra as DeepLinkWithData).data = parsedData;
|
||||
break;
|
||||
}
|
||||
case DeepLinkType.Permalink: {
|
||||
case DeepLink.Permalink: {
|
||||
const parsedData = parsed.data as DeepLinkPermalink;
|
||||
(launchProps.extra as DeepLinkWithData).data = parsedData;
|
||||
break;
|
||||
@@ -213,7 +214,7 @@ export const getLaunchPropsFromDeepLink = (deepLinkUrl: string): LaunchProps =>
|
||||
|
||||
export const getLaunchPropsFromNotification = async (notification: NotificationWithData): Promise<LaunchProps> => {
|
||||
const launchProps: LaunchProps = {
|
||||
launchType: LaunchType.Notification,
|
||||
launchType: Launch.Notification,
|
||||
};
|
||||
|
||||
const {payload} = notification;
|
||||
|
||||
@@ -7,7 +7,7 @@ import semver from 'semver';
|
||||
|
||||
import {selectAllMyChannelIds} from '@actions/local/channel';
|
||||
import LocalConfig from '@assets/config.json';
|
||||
import {Events, Sso} from '@constants';
|
||||
import {Events, Sso, Launch} from '@constants';
|
||||
import DatabaseManager from '@database/manager';
|
||||
import {DEFAULT_LOCALE, getTranslations, resetMomentLocale, t} from '@i18n';
|
||||
import {getServerCredentials, removeServerCredentials} from '@init/credentials';
|
||||
@@ -18,9 +18,11 @@ import NetworkManager from '@managers/network_manager';
|
||||
import WebsocketManager from '@managers/websocket_manager';
|
||||
import {getCurrentUser} from '@queries/servers/user';
|
||||
import EphemeralStore from '@store/ephemeral_store';
|
||||
import {LaunchType} from '@typings/launch';
|
||||
import {deleteFileCache} from '@utils/file';
|
||||
|
||||
import type {jsAndNativeErrorHandler} from '@typings/global/error_handling';
|
||||
import type {LaunchType} from '@typings/launch';
|
||||
|
||||
type LinkingCallbackArg = {url: string};
|
||||
|
||||
type LogoutCallbackArg = {
|
||||
@@ -116,10 +118,10 @@ class GlobalEventHandler {
|
||||
|
||||
if (activeServerUrl === serverUrl) {
|
||||
let displayName = '';
|
||||
let launchType: LaunchType = LaunchType.AddServer;
|
||||
let launchType: LaunchType = Launch.AddServer;
|
||||
if (!Object.keys(DatabaseManager.serverDatabases).length) {
|
||||
EphemeralStore.theme = undefined;
|
||||
launchType = LaunchType.Normal;
|
||||
launchType = Launch.Normal;
|
||||
|
||||
if (activeServerDisplayName) {
|
||||
displayName = activeServerDisplayName;
|
||||
|
||||
@@ -20,8 +20,6 @@ import ManagedApp from '@init/managed_app';
|
||||
import {logError} from '@utils/log';
|
||||
import {getCSRFFromCookie} from '@utils/security';
|
||||
|
||||
import type {ServerCredential} from '@typings/credentials';
|
||||
|
||||
const CLIENT_CERTIFICATE_IMPORT_ERROR_CODES = [-103, -104, -105, -108];
|
||||
const CLIENT_CERTIFICATE_MISSING_ERROR_CODE = -200;
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@ import {getCurrentUserId} from '@queries/servers/system';
|
||||
import {queryAllUsers} from '@queries/servers/user';
|
||||
import {logError} from '@utils/log';
|
||||
|
||||
import type {ServerCredential} from '@typings/credentials';
|
||||
|
||||
const WAIT_TO_CLOSE = 15 * 1000;
|
||||
const WAIT_UNTIL_NEXT = 20 * 1000;
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ import {getPreferenceAsBool} from '@helpers/api/preference';
|
||||
import {observeChannel} from '@queries/servers/channel';
|
||||
import {queryPreferencesByCategoryAndName} from '@queries/servers/preference';
|
||||
import {observeCurrentUser, observeTeammateNameDisplay, observeUser} from '@queries/servers/user';
|
||||
import {WithDatabaseArgs} from '@typings/database/database';
|
||||
|
||||
import type {WithDatabaseArgs} from '@typings/database/database';
|
||||
import type PostModel from '@typings/database/models/servers/post';
|
||||
|
||||
const enhanced = withObservables(['post'], ({post, database}: { post: PostModel } & WithDatabaseArgs) => {
|
||||
|
||||
@@ -11,7 +11,8 @@ import {observeCallsState, observeCurrentCall} from '@calls/state';
|
||||
import {idsAreEqual} from '@calls/utils';
|
||||
import {observeChannel} from '@queries/servers/channel';
|
||||
import {queryUsersById} from '@queries/servers/user';
|
||||
import {WithDatabaseArgs} from '@typings/database/database';
|
||||
|
||||
import type {WithDatabaseArgs} from '@typings/database/database';
|
||||
|
||||
type OwnProps = {
|
||||
serverUrl: string;
|
||||
|
||||
@@ -33,8 +33,7 @@ import {CallParticipant, CurrentCall, VoiceEventData} from '@calls/types/calls';
|
||||
import {sortParticipants} from '@calls/utils';
|
||||
import CompassIcon from '@components/compass_icon';
|
||||
import SlideUpPanelItem, {ITEM_HEIGHT} from '@components/slide_up_panel_item';
|
||||
import {WebsocketEvents} from '@constants';
|
||||
import Screens from '@constants/screens';
|
||||
import {WebsocketEvents, Screens} from '@constants';
|
||||
import {useTheme} from '@context/theme';
|
||||
import DatabaseManager from '@database/manager';
|
||||
import {bottomSheet, dismissBottomSheet, goToScreen, popTopScreen} from '@screens/navigation';
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
import {Alert} from 'react-native';
|
||||
|
||||
import {CallParticipant} from '@calls/types/calls';
|
||||
import {Post} from '@constants';
|
||||
import Calls from '@constants/calls';
|
||||
import PostModel from '@typings/database/models/servers/post';
|
||||
import {Post, Calls} from '@constants';
|
||||
import {isMinimumServerVersion} from '@utils/helpers';
|
||||
import {displayUsername} from '@utils/user';
|
||||
|
||||
import type PostModel from '@typings/database/models/servers/post';
|
||||
import type {IntlShape} from 'react-intl';
|
||||
|
||||
export function sortParticipants(teammateNameDisplay: string, participants?: Dictionary<CallParticipant>, presenterID?: string): CallParticipant[] {
|
||||
|
||||
@@ -5,7 +5,7 @@ import React, {useCallback} from 'react';
|
||||
import {ScrollView, View} from 'react-native';
|
||||
import {Edge, SafeAreaView} from 'react-native-safe-area-context';
|
||||
|
||||
import ChannelInfoEnableCalls from '@app/products/calls/components/channel_info_enable_calls';
|
||||
import ChannelInfoEnableCalls from '@calls/components/channel_info_enable_calls';
|
||||
import ChannelActions from '@components/channel_actions';
|
||||
import {useTheme} from '@context/theme';
|
||||
import useNavButtonPressed from '@hooks/navigation_button_pressed';
|
||||
|
||||
@@ -17,6 +17,8 @@ import {typography} from '@utils/typography';
|
||||
|
||||
import DownloadWithAction from '../footer/download_with_action';
|
||||
|
||||
import type {GalleryAction, GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type Props = {
|
||||
canDownloadFiles: boolean;
|
||||
item: GalleryItemType;
|
||||
|
||||
@@ -13,6 +13,8 @@ import Toast from '@components/toast';
|
||||
import {GALLERY_FOOTER_HEIGHT} from '@constants/gallery';
|
||||
import {useServerUrl} from '@context/server';
|
||||
|
||||
import type {GalleryAction, GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type Props = {
|
||||
item: GalleryItemType;
|
||||
setAction: (action: GalleryAction) => void;
|
||||
|
||||
@@ -25,6 +25,7 @@ import {galleryItemToFileInfo} from '@utils/gallery';
|
||||
import {typography} from '@utils/typography';
|
||||
|
||||
import type {ClientResponse, ProgressPromise} from '@mattermost/react-native-network-client';
|
||||
import type {GalleryAction, GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type Props = {
|
||||
action: GalleryAction;
|
||||
|
||||
@@ -20,6 +20,7 @@ import DownloadWithAction from './download_with_action';
|
||||
|
||||
import type PostModel from '@typings/database/models/servers/post';
|
||||
import type UserModel from '@typings/database/models/servers/user';
|
||||
import type {GalleryAction, GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type Props = {
|
||||
author?: UserModel;
|
||||
|
||||
@@ -16,6 +16,7 @@ import Footer from './footer';
|
||||
|
||||
import type {WithDatabaseArgs} from '@typings/database/database';
|
||||
import type ChannelModel from '@typings/database/models/servers/channel';
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type FooterProps = WithDatabaseArgs & {
|
||||
item: GalleryItemType;
|
||||
|
||||
@@ -16,6 +16,8 @@ import Backdrop, {BackdropProps} from './lightbox_swipeout/backdrop';
|
||||
import VideoRenderer from './video_renderer';
|
||||
import GalleryViewer from './viewer';
|
||||
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
// @ts-expect-error FastImage does work with Animated.createAnimatedComponent
|
||||
const AnimatedImage = Animated.createAnimatedComponent(FastImage);
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ import Footer from './footer';
|
||||
import Gallery, {GalleryRef} from './gallery';
|
||||
import Header from './header';
|
||||
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type Props = {
|
||||
galleryIdentifier: string;
|
||||
hideActions: boolean;
|
||||
|
||||
@@ -18,6 +18,7 @@ import {freezeOtherScreens} from '@utils/gallery';
|
||||
import {calculateDimensions} from '@utils/images';
|
||||
|
||||
import type {BackdropProps} from './backdrop';
|
||||
import type {GalleryItemType, GalleryManagerSharedValues} from '@typings/screens/gallery';
|
||||
|
||||
interface Size {
|
||||
height: number;
|
||||
|
||||
@@ -11,6 +11,8 @@ import {clampVelocity, friction, getShouldRender, workletNoop, workletNoopTrue}
|
||||
|
||||
import Page, {PageRefs, RenderPageProps} from './page';
|
||||
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
export interface PagerReusableProps {
|
||||
gutterWidth?: number;
|
||||
initialDiffValue?: number;
|
||||
|
||||
@@ -10,6 +10,8 @@ import {typedMemo} from '@utils/gallery';
|
||||
|
||||
import Gutter from './gutter';
|
||||
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
export type PageRefs = [
|
||||
React.Ref<TapGestureHandler>,
|
||||
React.Ref<PanGestureHandler>,
|
||||
|
||||
@@ -18,6 +18,7 @@ import {changeOpacity} from '@utils/theme';
|
||||
import DownloadWithAction from '../footer/download_with_action';
|
||||
|
||||
import type {ImageRendererProps} from '../image_renderer';
|
||||
import type {GalleryAction} from '@typings/screens/gallery';
|
||||
|
||||
interface VideoRendererProps extends ImageRendererProps {
|
||||
index: number;
|
||||
|
||||
@@ -9,6 +9,8 @@ import {InteractionType} from '../image_renderer/transformer';
|
||||
import Pager from '../pager';
|
||||
import {RenderPageProps} from '../pager/page';
|
||||
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
export interface GalleryViewerProps extends Handlers {
|
||||
gutterWidth?: number;
|
||||
height: number;
|
||||
|
||||
@@ -12,6 +12,8 @@ import DownloadWithAction from '@screens/gallery/footer/download_with_action';
|
||||
|
||||
import Header from './header';
|
||||
|
||||
import type {GalleryAction, GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
toast: {
|
||||
marginTop: 100,
|
||||
|
||||
@@ -6,9 +6,9 @@ import {StyleSheet, FlatList, ListRenderItemInfo, StyleProp, View, ViewStyle} fr
|
||||
import Animated from 'react-native-reanimated';
|
||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||
|
||||
import {ITEM_HEIGHT} from '@app/components/option_item';
|
||||
import File from '@components/files/file';
|
||||
import NoResultsWithTerm from '@components/no_results_with_term';
|
||||
import {ITEM_HEIGHT} from '@components/option_item';
|
||||
import DateSeparator from '@components/post_list/date_separator';
|
||||
import PostWithChannelInfo from '@components/post_with_channel_info';
|
||||
import {Screens} from '@constants';
|
||||
|
||||
13
app/screens/login/types.d.ts
vendored
13
app/screens/login/types.d.ts
vendored
@@ -1,13 +0,0 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
type LoginOptionWithConfigProps = {
|
||||
ssoType?: string;
|
||||
config: ClientConfig;
|
||||
onPress: (type: string|GestureResponderEvent) => void | (() => void);
|
||||
theme: Theme;
|
||||
}
|
||||
|
||||
type LoginOptionWithConfigAndLicenseProps = LoginOptionWithConfigProps & {
|
||||
license?: ClientLicense;
|
||||
};
|
||||
@@ -10,19 +10,18 @@ import tinyColor from 'tinycolor2';
|
||||
|
||||
import CompassIcon from '@components/compass_icon';
|
||||
import {ITEM_HEIGHT} from '@components/team_sidebar/add_team/team_list_item/team_list_item';
|
||||
import {Device, Events, Screens} from '@constants';
|
||||
import NavigationConstants from '@constants/navigation';
|
||||
import {Device, Events, Screens, Navigation as NavigationConstants, Launch} from '@constants';
|
||||
import {NOT_READY} from '@constants/screens';
|
||||
import {getDefaultThemeByAppearance} from '@context/theme';
|
||||
import {TITLE_HEIGHT} from '@screens/bottom_sheet/content';
|
||||
import EphemeralStore from '@store/ephemeral_store';
|
||||
import NavigationStore from '@store/navigation_store';
|
||||
import {LaunchProps, LaunchType} from '@typings/launch';
|
||||
import {bottomSheetSnapPoint} from '@utils/helpers';
|
||||
import {appearanceControlledScreens, mergeNavigationOptions} from '@utils/navigation';
|
||||
import {changeOpacity, setNavigatorStyles} from '@utils/theme';
|
||||
|
||||
import type TeamModel from '@typings/database/models/servers/team';
|
||||
import type {LaunchProps} from '@typings/launch';
|
||||
import type {NavButtons} from '@typings/screens/navigation';
|
||||
|
||||
const {MattermostManaged} = NativeModules;
|
||||
@@ -187,12 +186,12 @@ function isScreenRegistered(screen: string) {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function resetToHome(passProps: LaunchProps = {launchType: LaunchType.Normal}) {
|
||||
export function resetToHome(passProps: LaunchProps = {launchType: Launch.Normal}) {
|
||||
const theme = getThemeFromState();
|
||||
const isDark = tinyColor(theme.sidebarBg).isDark();
|
||||
StatusBar.setBarStyle(isDark ? 'light-content' : 'dark-content');
|
||||
|
||||
if (passProps.launchType === LaunchType.AddServer) {
|
||||
if (passProps.launchType === Launch.AddServer) {
|
||||
dismissModal({componentId: Screens.SERVER});
|
||||
dismissModal({componentId: Screens.LOGIN});
|
||||
dismissModal({componentId: Screens.SSO});
|
||||
|
||||
@@ -10,11 +10,11 @@ import {observePost} from '@queries/servers/post';
|
||||
import {observeCurrentTeamId, observeCurrentUserId} from '@queries/servers/system';
|
||||
import {queryMyTeamsByIds, queryTeamByName} from '@queries/servers/team';
|
||||
import {observeIsCRTEnabled} from '@queries/servers/thread';
|
||||
import PostModel from '@typings/database/models/servers/post';
|
||||
|
||||
import Permalink from './permalink';
|
||||
|
||||
import type {WithDatabaseArgs} from '@typings/database/database';
|
||||
import type PostModel from '@typings/database/models/servers/post';
|
||||
|
||||
type OwnProps = {
|
||||
postId: PostModel['id'];
|
||||
|
||||
@@ -15,7 +15,7 @@ import {fetchConfigAndLicense} from '@actions/remote/systems';
|
||||
import LocalConfig from '@assets/config.json';
|
||||
import ClientError from '@client/rest/error';
|
||||
import AppVersion from '@components/app_version';
|
||||
import {Screens} from '@constants';
|
||||
import {Screens, Launch} from '@constants';
|
||||
import {PUSH_PROXY_RESPONSE_NOT_AVAILABLE, PUSH_PROXY_RESPONSE_UNKNOWN, PUSH_PROXY_STATUS_NOT_AVAILABLE, PUSH_PROXY_STATUS_UNKNOWN, PUSH_PROXY_STATUS_VERIFIED} from '@constants/push_proxy';
|
||||
import DatabaseManager from '@database/manager';
|
||||
import {t} from '@i18n';
|
||||
@@ -24,7 +24,6 @@ import {queryServerByDisplayName, queryServerByIdentifier} from '@queries/app/se
|
||||
import Background from '@screens/background';
|
||||
import {dismissModal, goToScreen, loginAnimationOptions} from '@screens/navigation';
|
||||
import EphemeralStore from '@store/ephemeral_store';
|
||||
import {DeepLinkWithData, LaunchProps, LaunchType} from '@typings/launch';
|
||||
import {getErrorMessage} from '@utils/client_error';
|
||||
import {alertPushProxyError, alertPushProxyUnknown} from '@utils/push_proxy';
|
||||
import {loginOptions} from '@utils/server';
|
||||
@@ -34,6 +33,8 @@ import {getServerUrlAfterRedirect, isValidUrl, sanitizeUrl} from '@utils/url';
|
||||
import ServerForm from './form';
|
||||
import ServerHeader from './header';
|
||||
|
||||
import type {DeepLinkWithData, LaunchProps} from '@typings/launch';
|
||||
|
||||
interface ServerProps extends LaunchProps {
|
||||
closeButtonId?: string;
|
||||
componentId: string;
|
||||
@@ -78,7 +79,7 @@ const Server = ({
|
||||
let serverUrl: string | undefined = defaultServerUrl || managedConfig?.serverUrl || LocalConfig.DefaultServerUrl;
|
||||
let autoconnect = managedConfig?.allowOtherServers === 'false' || LocalConfig.AutoSelectServerUrl;
|
||||
|
||||
if (launchType === LaunchType.DeepLink) {
|
||||
if (launchType === Launch.DeepLink) {
|
||||
const deepLinkServerUrl = (extra as DeepLinkWithData).data?.serverUrl;
|
||||
if (managedConfig) {
|
||||
autoconnect = (managedConfig.allowOtherServers === 'false' && managedConfig.serverUrl === deepLinkServerUrl);
|
||||
@@ -92,7 +93,7 @@ const Server = ({
|
||||
autoconnect = true;
|
||||
serverUrl = deepLinkServerUrl;
|
||||
}
|
||||
} else if (launchType === LaunchType.AddServer) {
|
||||
} else if (launchType === Launch.AddServer) {
|
||||
serverName = defaultDisplayName;
|
||||
serverUrl = defaultServerUrl;
|
||||
}
|
||||
@@ -335,11 +336,11 @@ const Server = ({
|
||||
style={styles.flex}
|
||||
>
|
||||
<ServerHeader
|
||||
additionalServer={launchType === LaunchType.AddServer}
|
||||
additionalServer={launchType === Launch.AddServer}
|
||||
theme={theme}
|
||||
/>
|
||||
<ServerForm
|
||||
autoFocus={launchType === LaunchType.AddServer}
|
||||
autoFocus={launchType === Launch.AddServer}
|
||||
buttonDisabled={buttonDisabled}
|
||||
connecting={connecting}
|
||||
displayName={displayName}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
import React from 'react';
|
||||
|
||||
import {Preferences} from '@constants';
|
||||
import LaunchType from '@constants/launch';
|
||||
import {renderWithIntl} from '@test/intl-test-helper';
|
||||
import {LaunchType} from '@typings/launch';
|
||||
|
||||
import SSOLogin from './index';
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import UserProfileAvatar from './avatar';
|
||||
import UserProfileTag from './tag';
|
||||
|
||||
import type UserModel from '@typings/database/models/servers/user';
|
||||
import type {GalleryItemType} from '@typings/screens/gallery';
|
||||
|
||||
type Props = {
|
||||
enablePostIconOverride: boolean;
|
||||
|
||||
@@ -11,6 +11,8 @@ import {showOverlay} from '@screens/navigation';
|
||||
import {isImage, isVideo} from '@utils/file';
|
||||
import {generateId} from '@utils/general';
|
||||
|
||||
import type {GalleryItemType, GalleryManagerSharedValues} from '@typings/screens/gallery';
|
||||
|
||||
export const clamp = (value: number, lowerBound: number, upperBound: number) => {
|
||||
'worklet';
|
||||
|
||||
|
||||
@@ -5,9 +5,8 @@ import {IntlShape} from 'react-intl';
|
||||
import {Alert, AlertButton} from 'react-native';
|
||||
|
||||
import CompassIcon from '@components/compass_icon';
|
||||
import {Screens, Sso, SupportedServer} from '@constants';
|
||||
import {Screens, Sso, SupportedServer, Launch} from '@constants';
|
||||
import {dismissBottomSheet, showModal} from '@screens/navigation';
|
||||
import {LaunchType} from '@typings/launch';
|
||||
import {getErrorMessage} from '@utils/client_error';
|
||||
import {changeOpacity} from '@utils/theme';
|
||||
import {tryOpenURL} from '@utils/url';
|
||||
@@ -41,7 +40,7 @@ export async function addNewServer(theme: Theme, serverUrl?: string, displayName
|
||||
const props = {
|
||||
closeButtonId,
|
||||
displayName,
|
||||
launchType: LaunchType.AddServer,
|
||||
launchType: Launch.AddServer,
|
||||
serverUrl,
|
||||
theme,
|
||||
};
|
||||
@@ -85,7 +84,7 @@ export async function loginToServer(theme: Theme, serverUrl: string, displayName
|
||||
closeButtonId,
|
||||
config,
|
||||
hasLoginForm,
|
||||
launchType: LaunchType.AddServer,
|
||||
launchType: Launch.AddServer,
|
||||
license,
|
||||
serverDisplayName: displayName,
|
||||
serverUrl,
|
||||
|
||||
@@ -5,13 +5,14 @@ import GenericClient from '@mattermost/react-native-network-client';
|
||||
import {Linking} from 'react-native';
|
||||
import urlParse from 'url-parse';
|
||||
|
||||
import {Files} from '@constants';
|
||||
import {DeepLinkType, DeepLinkWithData} from '@typings/launch';
|
||||
import {Files, DeepLink} from '@constants';
|
||||
import {emptyFunction} from '@utils/general';
|
||||
import {escapeRegex} from '@utils/markdown';
|
||||
|
||||
import {latinise} from './latinise';
|
||||
|
||||
import type {DeepLinkWithData} from '@typings/launch';
|
||||
|
||||
const ytRegex = /(?:http|https):\/\/(?:www\.|m\.)?(?:(?:youtube\.com\/(?:(?:v\/)|(?:(?:watch|embed\/watch)(?:\/|.*v=))|(?:embed\/)|(?:user\/[^/]+\/u\/[0-9]\/)))|(?:youtu\.be\/))([^#&?]*)/;
|
||||
|
||||
export function isValidUrl(url = '') {
|
||||
@@ -141,30 +142,30 @@ export function parseDeepLink(deepLinkUrl: string): DeepLinkWithData {
|
||||
|
||||
let match = new RegExp('(.*)\\/([^\\/]+)\\/channels\\/(\\S+)').exec(url);
|
||||
if (match) {
|
||||
return {type: DeepLinkType.Channel, data: {serverUrl: match[1], teamName: match[2], channelName: match[3]}};
|
||||
return {type: DeepLink.Channel, data: {serverUrl: match[1], teamName: match[2], channelName: match[3]}};
|
||||
}
|
||||
|
||||
match = new RegExp('(.*)\\/([^\\/]+)\\/pl\\/(\\w+)').exec(url);
|
||||
if (match) {
|
||||
return {type: DeepLinkType.Permalink, data: {serverUrl: match[1], teamName: match[2], postId: match[3]}};
|
||||
return {type: DeepLink.Permalink, data: {serverUrl: match[1], teamName: match[2], postId: match[3]}};
|
||||
}
|
||||
|
||||
match = new RegExp('(.*)\\/([^\\/]+)\\/messages\\/@(\\S+)').exec(url);
|
||||
if (match) {
|
||||
return {type: DeepLinkType.DirectMessage, data: {serverUrl: match[1], teamName: match[2], userName: match[3]}};
|
||||
return {type: DeepLink.DirectMessage, data: {serverUrl: match[1], teamName: match[2], userName: match[3]}};
|
||||
}
|
||||
|
||||
match = new RegExp('(.*)\\/([^\\/]+)\\/messages\\/(\\S+)').exec(url);
|
||||
if (match) {
|
||||
return {type: DeepLinkType.GroupMessage, data: {serverUrl: match[1], teamName: match[2], channelId: match[3]}};
|
||||
return {type: DeepLink.GroupMessage, data: {serverUrl: match[1], teamName: match[2], channelId: match[3]}};
|
||||
}
|
||||
|
||||
match = new RegExp('(.*)\\/plugins\\/([^\\/]+)\\/(\\S+)').exec(url);
|
||||
if (match) {
|
||||
return {type: DeepLinkType.Plugin, data: {serverUrl: match[1], id: match[2], teamName: ''}};
|
||||
return {type: DeepLink.Plugin, data: {serverUrl: match[1], id: match[2], teamName: ''}};
|
||||
}
|
||||
|
||||
return {type: DeepLinkType.Invalid};
|
||||
return {type: DeepLink.Invalid};
|
||||
}
|
||||
|
||||
export function matchDeepLink(url?: string, serverURL?: string, siteURL?: string) {
|
||||
@@ -185,7 +186,7 @@ export function matchDeepLink(url?: string, serverURL?: string, siteURL?: string
|
||||
}
|
||||
|
||||
const parsedDeepLink = parseDeepLink(urlToMatch);
|
||||
if (parsedDeepLink.type !== DeepLinkType.Invalid) {
|
||||
if (parsedDeepLink.type !== DeepLink.Invalid) {
|
||||
return parsedDeepLink;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import {Linking} from 'react-native';
|
||||
|
||||
import {DeepLinkType} from '@typings/launch';
|
||||
import DeepLinkType from '@constants/deep_linking';
|
||||
import * as UrlUtils from '@utils/url';
|
||||
|
||||
/* eslint-disable max-nested-callbacks */
|
||||
|
||||
3
types/api/posts.d.ts
vendored
3
types/api/posts.d.ts
vendored
@@ -55,7 +55,7 @@ type Post = {
|
||||
original_id: string;
|
||||
message: string;
|
||||
type: PostType;
|
||||
participants?: null | UserProfile[];
|
||||
participants?: null | UserProfile[]|string[];
|
||||
props: Record<string, any>;
|
||||
hashtags: string;
|
||||
pending_post_id: string;
|
||||
@@ -66,7 +66,6 @@ type Post = {
|
||||
user_activity_posts?: Post[];
|
||||
state?: 'DELETED';
|
||||
prev_post_id?: string;
|
||||
participants: null|string[];
|
||||
};
|
||||
|
||||
type PostProps = {
|
||||
|
||||
2
types/api/threads.d.ts
vendored
2
types/api/threads.d.ts
vendored
@@ -23,7 +23,7 @@ type ThreadWithViewedAt = Thread & {
|
||||
};
|
||||
|
||||
type ThreadParticipant = {
|
||||
id: $ID<User>;
|
||||
id: $ID<UserProfile>;
|
||||
thread_id: $ID<Thread>;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Asset} from 'react-native-image-picker';
|
||||
import type {Asset} from 'react-native-image-picker';
|
||||
|
||||
export interface QuickActionAttachmentProps {
|
||||
disabled: boolean;
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {ViewToken} from 'react-native';
|
||||
import type {ViewToken} from 'react-native';
|
||||
|
||||
export type ViewableItemsChanged = {
|
||||
viewableItems: ViewToken[];
|
||||
2
types/credentials/index.d.ts
vendored
2
types/credentials/index.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
export type ServerCredential = {
|
||||
type ServerCredential = {
|
||||
serverUrl: string;
|
||||
userId: string;
|
||||
token: string;
|
||||
|
||||
@@ -3,22 +3,20 @@
|
||||
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
import {Database} from '@nozbe/watermelondb';
|
||||
import Model from '@nozbe/watermelondb/Model';
|
||||
import {Clause} from '@nozbe/watermelondb/QueryDescription';
|
||||
import {Class} from '@nozbe/watermelondb/utils/common';
|
||||
|
||||
import {DatabaseType} from './enums';
|
||||
|
||||
import type {DatabaseType} from '@constants/database';
|
||||
import type AppDataOperator from '@database/operator/app_data_operator';
|
||||
import type ServerDataOperator from '@database/operator/server_data_operator';
|
||||
import type {Database} from '@nozbe/watermelondb';
|
||||
import type Model from '@nozbe/watermelondb/Model';
|
||||
import type {Clause} from '@nozbe/watermelondb/QueryDescription';
|
||||
import type {Class} from '@nozbe/watermelondb/utils/common';
|
||||
import type System from '@typings/database/models/servers/system';
|
||||
|
||||
export type WithDatabaseArgs = { database: Database }
|
||||
|
||||
export type CreateServerDatabaseConfig = {
|
||||
dbName: string;
|
||||
dbType?: DatabaseType.DEFAULT | DatabaseType.SERVER;
|
||||
dbType?: DatabaseType;
|
||||
displayName?: string;
|
||||
serverUrl?: string;
|
||||
identifier?: string;
|
||||
@@ -58,7 +56,7 @@ export type OperationArgs = {
|
||||
createRaws?: RecordPair[];
|
||||
updateRaws?: RecordPair[];
|
||||
deleteRaws?: Model[];
|
||||
transformer: (TransformerArgs) => Promise<Model>;
|
||||
transformer: (args: TransformerArgs) => Promise<Model>;
|
||||
};
|
||||
|
||||
export type Models = Array<Class<Model>>;
|
||||
@@ -155,7 +153,7 @@ export type ProcessRecordsArgs = {
|
||||
export type HandleRecordsArgs = {
|
||||
buildKeyRecordBy?: (obj: Record<string, any>) => string;
|
||||
fieldName: string;
|
||||
transformer: (TransformerArgs) => Promise<Model>;
|
||||
transformer: (args: TransformerArgs) => Promise<Model>;
|
||||
createOrUpdateRawValues: RawValue[];
|
||||
deleteRawValues?: RawValue[];
|
||||
tableName: string;
|
||||
@@ -1,14 +0,0 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
export enum OperationType {
|
||||
CREATE = 'CREATE',
|
||||
UPDATE = 'UPDATE',
|
||||
DELETE = 'DELETE',
|
||||
}
|
||||
|
||||
// The only two types of databases in the app
|
||||
export enum DatabaseType {
|
||||
DEFAULT,
|
||||
SERVER,
|
||||
}
|
||||
@@ -1,16 +1,18 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
import type {Model} from '@nozbe/watermelondb';
|
||||
|
||||
/**
|
||||
* The Global model will act as a dictionary of name-value pairs. The value field can be a JSON object or any other
|
||||
* data type. It will hold information that applies to the whole app ( e.g. sidebar settings for tablets)
|
||||
*/
|
||||
export default class GlobalModel extends Model {
|
||||
declare class GlobalModel extends Model {
|
||||
/** table (name) : global */
|
||||
static table: string;
|
||||
|
||||
/** value : The value part of the key-value combination and whose key will be the id column */
|
||||
value: any;
|
||||
}
|
||||
|
||||
export default GlobalModel;
|
||||
@@ -1,13 +1,13 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
import type {Model} from '@nozbe/watermelondb';
|
||||
|
||||
/**
|
||||
* The App model will hold information - such as the version number, build number and creation date -
|
||||
* for the Mattermost mobile app.
|
||||
*/
|
||||
export default class InfoModel extends Model {
|
||||
declare class InfoModel extends Model {
|
||||
/** table (name) : app */
|
||||
static table: string;
|
||||
|
||||
@@ -20,3 +20,5 @@ export default class InfoModel extends Model {
|
||||
/** version_number : Version number for the app */
|
||||
versionNumber: string;
|
||||
}
|
||||
|
||||
export default InfoModel;
|
||||
@@ -1,13 +1,13 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
import type {Model} from '@nozbe/watermelondb';
|
||||
|
||||
/**
|
||||
* The Server model will help us to identify the various servers a user will log in; in the context of
|
||||
* multi-server support system. The db_path field will hold the App-Groups file-path
|
||||
*/
|
||||
export default class ServersModel extends Model {
|
||||
declare class ServersModel extends Model {
|
||||
/** table (name) : servers */
|
||||
static table: string;
|
||||
|
||||
@@ -21,8 +21,10 @@ export default class ServersModel extends Model {
|
||||
url: string;
|
||||
|
||||
/** last_active_at: The last time this server was active */
|
||||
lastActiveAt!: number;
|
||||
lastActiveAt: number;
|
||||
|
||||
/** diagnostic_id: Determines the installation identifier of a server */
|
||||
identifier!: string;
|
||||
identifier: string;
|
||||
}
|
||||
|
||||
export default ServersModel;
|
||||
@@ -1,20 +1,20 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Query, Relation} from '@nozbe/watermelondb';
|
||||
import {lazy} from '@nozbe/watermelondb/decorators';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
import {Observable} from 'rxjs';
|
||||
|
||||
import type CategoryChannelModel from './category_channel';
|
||||
import type ChannelModel from './channel';
|
||||
import type MyChannelModel from './my_channel';
|
||||
import type TeamModel from './team';
|
||||
import type {Query, Relation, Model} from '@nozbe/watermelondb';
|
||||
import type {Associations} from '@nozbe/watermelondb/Model';
|
||||
import type {Observable} from 'rxjs';
|
||||
|
||||
/**
|
||||
* A Category groups together channels for a user in a team.
|
||||
*/
|
||||
export default class CategoryModel extends Model {
|
||||
declare class CategoryModel extends Model {
|
||||
/** table (name) : Category */
|
||||
static table: string;
|
||||
|
||||
@@ -63,3 +63,5 @@ export default class CategoryModel extends Model {
|
||||
/** toCategoryWithChannels returns a map of the Category with an array of ordered channel ids */
|
||||
toCategoryWithChannels(): Promise<CategoryWithChannels>;
|
||||
}
|
||||
|
||||
export default CategoryModel;
|
||||
@@ -1,18 +1,17 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import type CategoryModel from './category';
|
||||
import type ChannelModel from './channel';
|
||||
import type MyChannelModel from './my_channel';
|
||||
import type {Relation, Model} from '@nozbe/watermelondb';
|
||||
import type {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
/**
|
||||
* The CategoryChannel model represents the 'association table' where many categories have channels and many channels are in
|
||||
* categories (relationship type N:N)
|
||||
*/
|
||||
export default class CategoryChannelModel extends Model {
|
||||
declare class CategoryChannelModel extends Model {
|
||||
/** table (name) : CategoryChannel */
|
||||
static table: string;
|
||||
|
||||
@@ -37,3 +36,5 @@ export default class CategoryChannelModel extends Model {
|
||||
/** myChannel : The related myChannel */
|
||||
myChannel: Relation<MyChannelModel>;
|
||||
}
|
||||
|
||||
export default CategoryChannelModel;
|
||||
@@ -1,9 +1,6 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Query, Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import type CategoryChannelModel from './category_channel';
|
||||
import type ChannelInfoModel from './channel_info';
|
||||
import type ChannelMembershipModel from './channel_membership';
|
||||
@@ -13,11 +10,13 @@ import type PostModel from './post';
|
||||
import type PostsInChannelModel from './posts_in_channel';
|
||||
import type TeamModel from './team';
|
||||
import type UserModel from './user';
|
||||
import type {Query, Relation, Model} from '@nozbe/watermelondb';
|
||||
import type {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
/**
|
||||
* The Channel model represents a channel in the Mattermost app.
|
||||
*/
|
||||
export default class ChannelModel extends Model {
|
||||
declare class ChannelModel extends Model {
|
||||
/** table (name) : Channel */
|
||||
static table: string;
|
||||
|
||||
@@ -34,7 +33,7 @@ export default class ChannelModel extends Model {
|
||||
deleteAt: number;
|
||||
|
||||
/** update_at : The timestamp to when this channel was last updated on the server */
|
||||
updateAt!: number;
|
||||
updateAt: number;
|
||||
|
||||
/** display_name : The channel display name (e.g. Town Square ) */
|
||||
displayName: string;
|
||||
@@ -83,3 +82,5 @@ export default class ChannelModel extends Model {
|
||||
|
||||
toApi(): Channel;
|
||||
}
|
||||
|
||||
export default ChannelModel;
|
||||
@@ -1,17 +1,16 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model from '@nozbe/watermelondb/Model';
|
||||
|
||||
import type ChannelModel from './channel';
|
||||
import type {Relation} from '@nozbe/watermelondb';
|
||||
import type Model from '@nozbe/watermelondb/Model';
|
||||
|
||||
/**
|
||||
* ChannelInfo is an extension of the information contained in the Channel table.
|
||||
* In a Separation of Concerns approach, ChannelInfo will provide additional information about a channel but on a more
|
||||
* specific level.
|
||||
*/
|
||||
export default class ChannelInfoModel extends Model {
|
||||
declare class ChannelInfoModel extends Model {
|
||||
/** table (name) : ChannelInfo */
|
||||
static table: string;
|
||||
|
||||
@@ -33,3 +32,5 @@ export default class ChannelInfoModel extends Model {
|
||||
/** channel : The lazy query property to the record from the CHANNEL table */
|
||||
channel: Relation<ChannelModel>;
|
||||
}
|
||||
|
||||
export default ChannelInfoModel;
|
||||
@@ -1,17 +1,16 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Query, Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import type ChannelModel from './channel';
|
||||
import type UserModel from './user';
|
||||
import type {Query, Relation, Model} from '@nozbe/watermelondb';
|
||||
import type {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
/**
|
||||
* The ChannelMembership model represents the 'association table' where many channels have users and many users are on
|
||||
* channels ( N:N relationship between model Users and model Channel)
|
||||
*/
|
||||
export default class ChannelMembershipModel extends Model {
|
||||
declare class ChannelMembershipModel extends Model {
|
||||
/** table (name) : ChannelMembership */
|
||||
static table: string;
|
||||
|
||||
@@ -43,3 +42,5 @@ export default class ChannelMembershipModel extends Model {
|
||||
*/
|
||||
getAllUsersInChannel: Query<UserModel>;
|
||||
}
|
||||
|
||||
export default ChannelMembershipModel;
|
||||
@@ -1,13 +1,15 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
import type Model from '@nozbe/watermelondb/Model';
|
||||
|
||||
/** The CustomEmoji model describes all the custom emojis used in the Mattermost app */
|
||||
export default class CustomEmojiModel extends Model {
|
||||
declare class CustomEmojiModel extends Model {
|
||||
/** table (name) : CustomEmoji */
|
||||
static table: string;
|
||||
|
||||
/** name : The custom emoji's name*/
|
||||
name: string;
|
||||
}
|
||||
|
||||
export default CustomEmojiModel;
|
||||
@@ -1,12 +1,13 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
import type {Model} from '@nozbe/watermelondb';
|
||||
import type {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
/**
|
||||
* The Draft model represents the draft state of messages in Direct/Group messages and in channels
|
||||
*/
|
||||
export default class DraftModel extends Model {
|
||||
declare class DraftModel extends Model {
|
||||
/** table (name) : Draft */
|
||||
static table: string;
|
||||
|
||||
@@ -25,3 +26,5 @@ export default class DraftModel extends Model {
|
||||
/** files : The files field will hold an array of files object that have not yet been uploaded and persisted within the FILE table */
|
||||
files: FileInfo[];
|
||||
}
|
||||
|
||||
export default DraftModel;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user