Upgrade deps (#5850)

This commit is contained in:
Elias Nahum
2021-11-29 23:19:39 +02:00
committed by GitHub
parent 5419758a5f
commit 42f193c70c
42 changed files with 3117 additions and 4486 deletions

View File

@@ -96,7 +96,7 @@ export const fetchMyChannelsForTeam = async (serverUrl: string, teamId: string,
}
try {
let [channels, memberships] = await Promise.all<Channel[], ChannelMembership[]>([
let [channels, memberships]: [Channel[], ChannelMembership[]] = await Promise.all([
client.getMyChannels(teamId, includeDeleted, since),
client.getMyChannelMembers(teamId),
]);

View File

@@ -34,7 +34,7 @@ export const fetchGroupsForTeam = async (serverUrl: string, teamId: string) => {
const groupsTeams: GroupTeamRelation[] = [];
const groupMemberships: GroupMembership[] = [];
if (team.isGroupConstrained) {
const [groupsAssociatedToChannelsInTeam, groupsAssociatedToTeam] = await Promise.all<{groups: Record<string, Group[]>}, {groups: Group[]; total_group_count: number}>([
const [groupsAssociatedToChannelsInTeam, groupsAssociatedToTeam]: [{groups: Record<string, Group[]>}, {groups: Group[]; total_group_count: number}] = await Promise.all([
client.getAllGroupsAssociatedToChannelsInTeam(teamId, true),
client.getAllGroupsAssociatedToTeam(teamId, true),
]);
@@ -60,7 +60,7 @@ export const fetchGroupsForTeam = async (serverUrl: string, teamId: string) => {
}
} else {
const since = await queryWebSocketLastDisconnected(database);
const [groupsAssociatedToChannelsInTeam, allGroups] = await Promise.all<{groups: Record<string, Group[]>}, Group[]>([
const [groupsAssociatedToChannelsInTeam, allGroups]: [{groups: Record<string, Group[]>}, Group[]] = await Promise.all([
client.getAllGroupsAssociatedToChannelsInTeam(teamId, true),
client.getGroups(true, 0, 0, since),
]);

View File

@@ -63,7 +63,7 @@ export const fetchConfigAndLicense = async (serverUrl: string, fetchOnly = false
}
try {
const [config, license] = await Promise.all<ClientConfig, ClientLicense>([
const [config, license]: [ClientConfig, ClientLicense] = await Promise.all([
client.getClientConfigOld(),
client.getClientLicenseOld(),
]);

View File

@@ -83,7 +83,7 @@ export const fetchMyTeams = async (serverUrl: string, fetchOnly = false): Promis
}
try {
const [teams, memberships] = await Promise.all<Team[], TeamMembership[]>([
const [teams, memberships]: [Team[], TeamMembership[]] = await Promise.all([
client.getMyTeams(),
client.getMyTeamMembers(),
]);

View File

@@ -23,7 +23,7 @@ const ClientApps = (superclass: any) => class extends superclass {
`${this.getAppsProxyRoute()}/api/v1/call`,
{method: 'post', body: callCopy},
);
}
};
getAppsBindings = async (userID: string, channelID: string, teamID: string) => {
const params = {
@@ -37,7 +37,7 @@ const ClientApps = (superclass: any) => class extends superclass {
`${this.getAppsProxyRoute()}/api/v1/bindings${buildQueryString(params)}`,
{method: 'get'},
);
}
};
};
export default ClientApps;

View File

@@ -63,7 +63,7 @@ export default class ClientBase {
getWebSocketUrl = () => {
return `${this.urlVersion}/websocket`;
}
};
setAcceptLanguage(locale: string) {
this.requestHeaders[ClientConstants.HEADER_ACCEPT_LANGUAGE] = locale;

View File

@@ -41,7 +41,7 @@ const ClientFiles = (superclass: any) => class extends superclass {
`${this.getFileRoute(fileId)}/link`,
{method: 'get'},
);
}
};
};
export default ClientFiles;

View File

@@ -26,7 +26,8 @@ const ClientGroups = (superclass: any) => class extends superclass {
`${this.getUsersRoute()}/${userID}/groups`,
{method: 'get'},
);
}
};
getAllGroupsAssociatedToTeam = async (teamID: string, filterAllowReference = false) => {
return this.doFetch(
`${this.urlVersion}/teams/${teamID}/groups${buildQueryString({paginate: false, filter_allow_reference: filterAllowReference})}`,

View File

@@ -149,7 +149,7 @@ const ClientPosts = (superclass: any) => class extends superclass {
`${this.getUserRoute(userId)}/posts/${postId}/set_unread`,
{method: 'post'},
);
}
};
pinPost = async (postId: string) => {
this.analytics.trackAPI('api_posts_pin');

View File

@@ -12,14 +12,14 @@ const ClientTos = (superclass: any) => class extends superclass {
`${this.getUserRoute('me')}/terms_of_service`,
{method: 'post', body: {termsOfServiceId, accepted}},
);
}
};
getTermsOfService = async () => {
return this.doFetch(
`${this.urlVersion}/terms_of_service`,
{method: 'get'},
);
}
};
};
export default ClientTos;

View File

@@ -64,14 +64,14 @@ const ClientUsers = (superclass: any) => class extends superclass {
`${this.getUsersRoute()}${buildQueryString(queryParams)}`,
{method: 'post', body: user},
);
}
};
patchMe = async (userPatch: Partial<UserProfile>) => {
return this.doFetch(
`${this.getUserRoute('me')}/patch`,
{method: 'put', body: userPatch},
);
}
};
patchUser = async (userPatch: Partial<UserProfile> & {id: string}) => {
this.analytics.trackAPI('api_users_patch');
@@ -80,7 +80,7 @@ const ClientUsers = (superclass: any) => class extends superclass {
`${this.getUserRoute(userPatch.id)}/patch`,
{method: 'put', body: userPatch},
);
}
};
updateUser = async (user: UserProfile) => {
this.analytics.trackAPI('api_users_update');
@@ -89,7 +89,7 @@ const ClientUsers = (superclass: any) => class extends superclass {
`${this.getUserRoute(user.id)}`,
{method: 'put', body: user},
);
}
};
demoteUserToGuest = async (userId: string) => {
this.analytics.trackAPI('api_users_demote_user_to_guest');
@@ -98,7 +98,7 @@ const ClientUsers = (superclass: any) => class extends superclass {
`${this.getUserRoute(userId)}/demote`,
{method: 'post'},
);
}
};
getKnownUsers = async () => {
this.analytics.trackAPI('api_get_known_users');
@@ -107,7 +107,7 @@ const ClientUsers = (superclass: any) => class extends superclass {
`${this.getUsersRoute()}/known`,
{method: 'get'},
);
}
};
sendPasswordResetEmail = async (email: string) => {
this.analytics.trackAPI('api_users_send_password_reset');
@@ -116,7 +116,7 @@ const ClientUsers = (superclass: any) => class extends superclass {
`${this.getUsersRoute()}/password/reset/send`,
{method: 'post', body: {email}},
);
}
};
setDefaultProfileImage = async (userId: string) => {
this.analytics.trackAPI('api_users_set_default_profile_picture');

View File

@@ -1,5 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import Database from '@nozbe/watermelondb/Database';
import React from 'react';

View File

@@ -268,5 +268,7 @@ const FloatingTextInput = forwardRef<FloatingTextInputRef, FloatingTextInputProp
);
});
FloatingTextInput.displayName = 'FloatingTextInput';
export default FloatingTextInput;

View File

@@ -60,7 +60,7 @@ class MarkdownTable extends PureComponent<MarkdownTableProps, MarkdownTableState
setMaxPreviewColumns = ({window}: {window: ScaledSize}) => {
const maxPreviewColumns = Math.floor(window.width / CELL_MIN_WIDTH);
this.setState({maxPreviewColumns});
}
};
getTableWidth = (isFullView = false) => {
const maxPreviewColumns = this.state.maxPreviewColumns || MAX_PREVIEW_COLUMNS;
@@ -99,7 +99,7 @@ class MarkdownTable extends PureComponent<MarkdownTableProps, MarkdownTableState
renderPreviewRows = (isFullView = false) => {
return this.renderRows(isFullView, true);
}
};
shouldRenderAsFlex = (isFullView = false) => {
const {numColumns} = this.props;
@@ -125,7 +125,7 @@ class MarkdownTable extends PureComponent<MarkdownTableProps, MarkdownTableState
}
return false;
}
};
getTableStyle = (isFullView: boolean) => {
const {theme} = this.props;
@@ -140,7 +140,7 @@ class MarkdownTable extends PureComponent<MarkdownTableProps, MarkdownTableState
tableStyle.push({width: this.getTableWidth(isFullView)});
return tableStyle;
}
};
renderRows = (isFullView = false, isPreview = false) => {
const tableStyle = this.getTableStyle(isFullView);
@@ -186,7 +186,7 @@ class MarkdownTable extends PureComponent<MarkdownTableProps, MarkdownTableState
{rows}
</View>
);
}
};
render() {
const {containerWidth, contentHeight} = this.state;

View File

@@ -200,4 +200,6 @@ const DocumentFile = forwardRef<DocumentFileRef, DocumentFileProps>(({background
);
});
DocumentFile.displayName = 'DocumentFile';
export default DocumentFile;

View File

@@ -1,6 +1,9 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/* eslint-disable react/prop-types */
// We disable the prop types check here as forwardRef & typescript has a bug
import React, {forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState} from 'react';
import {useIntl} from 'react-intl';
import {ActivityIndicatorProps, Platform, StyleProp, TextInput, TextInputProps, TextStyle, TouchableOpacityProps, ViewStyle} from 'react-native';

View File

@@ -175,7 +175,7 @@ class DatabaseManager {
});
});
}
}
};
public updateServerDisplayName = async (serverUrl: string, displayName: string) => {
const appDatabase = this.appDatabase?.database;
@@ -187,7 +187,7 @@ class DatabaseManager {
});
});
}
}
};
private isServerPresent = async (serverUrl: string): Promise<boolean> => {
if (this.appDatabase?.database) {
@@ -196,7 +196,7 @@ class DatabaseManager {
}
return false;
}
};
public getActiveServerUrl = async (): Promise<string|null|undefined> => {
const database = this.appDatabase?.database;
@@ -206,7 +206,7 @@ class DatabaseManager {
}
return null;
}
};
public getServerUrlFromIdentifier = async (identifier: string): Promise<string|undefined> => {
const database = this.appDatabase?.database;
@@ -216,7 +216,7 @@ class DatabaseManager {
}
return undefined;
}
};
public getActiveServerDatabase = async (): Promise<Database|undefined> => {
const database = this.appDatabase?.database;
@@ -228,7 +228,7 @@ class DatabaseManager {
}
return undefined;
}
};
public setActiveServerDatabase = async (serverUrl: string): Promise<void> => {
if (this.appDatabase?.database) {
@@ -260,7 +260,7 @@ class DatabaseManager {
this.deleteServerDatabaseFiles(serverUrl);
}
}
}
};
public destroyServerDatabase = async (serverUrl: string): Promise<void> => {
if (this.appDatabase?.database) {
@@ -275,7 +275,7 @@ class DatabaseManager {
this.deleteServerDatabaseFiles(serverUrl);
}
}
}
};
private deleteServerDatabaseFiles = async (serverUrl: string): Promise<void> => {
const databaseName = hashCode(serverUrl);
@@ -293,7 +293,7 @@ class DatabaseManager {
await FileSystem.deleteAsync(databaseFile);
await FileSystem.deleteAsync(databaseJournal);
}
};
factoryReset = async (shouldRemoveDirectory: boolean): Promise<boolean> => {
try {

View File

@@ -220,7 +220,7 @@ class DatabaseManager {
});
});
}
}
};
public updateServerDisplayName = async (serverUrl: string, displayName: string) => {
const appDatabase = this.appDatabase?.database;
@@ -232,7 +232,7 @@ class DatabaseManager {
});
});
}
}
};
/**
* isServerPresent : Confirms if the current serverUrl does not already exist in the database
@@ -246,7 +246,7 @@ class DatabaseManager {
}
return false;
}
};
/**
* getActiveServerUrl: Get the record for active server database.
@@ -260,7 +260,7 @@ class DatabaseManager {
}
return null;
}
};
public getServerUrlFromIdentifier = async (identifier: string): Promise<string|undefined> => {
const database = this.appDatabase?.database;
@@ -270,7 +270,7 @@ class DatabaseManager {
}
return undefined;
}
};
/**
* getActiveServerDatabase: Get the record for active server database.
@@ -286,7 +286,7 @@ class DatabaseManager {
}
return undefined;
}
};
/**
* setActiveServerDatabase: Set the new active server database.
@@ -330,7 +330,7 @@ class DatabaseManager {
this.deleteServerDatabaseFiles(serverUrl);
}
}
}
};
/**
* destroyServerDatabase: Removes the *.db file from the App-Group directory for iOS or the files directory on Android.
@@ -351,7 +351,7 @@ class DatabaseManager {
this.deleteServerDatabaseFiles(serverUrl);
}
}
}
};
/**
* deleteServerDatabaseFiles: Removes the *.db file from the App-Group directory for iOS or the files directory on Android.
@@ -376,7 +376,7 @@ class DatabaseManager {
FileSystem.deleteAsync(databaseFile);
FileSystem.deleteAsync(databaseShm);
FileSystem.deleteAsync(databaseWal);
}
};
/**
* factoryReset: Removes the databases directory and all its contents on the respective platform

View File

@@ -140,5 +140,5 @@ export default class UserModel extends Model {
this.prepareUpdate((u) => {
u.status = status;
});
}
};
}

View File

@@ -28,7 +28,7 @@ export default class AppDataOperator extends BaseDataOperator {
createOrUpdateRawValues: getUniqueRawsBy({raws: info, key: 'version_number'}),
tableName: INFO,
});
}
};
handleGlobal = async ({global, prepareRecordsOnly = true}: HandleGlobalArgs) => {
if (!global.length) {
@@ -45,5 +45,5 @@ export default class AppDataOperator extends BaseDataOperator {
createOrUpdateRawValues: getUniqueRawsBy({raws: global, key: 'id'}),
tableName: GLOBAL,
});
}
};
}

View File

@@ -43,7 +43,7 @@ export default class ServerDataOperatorBase extends BaseDataOperator {
createOrUpdateRawValues: getUniqueRawsBy({raws: roles, key: 'id'}),
tableName: ROLE,
}) as Promise<RoleModel[]>;
}
};
handleCustomEmojis = ({emojis, prepareRecordsOnly = true}: HandleCustomEmojiArgs) => {
if (!emojis.length) {
@@ -60,7 +60,7 @@ export default class ServerDataOperatorBase extends BaseDataOperator {
createOrUpdateRawValues: getUniqueRawsBy({raws: emojis, key: 'name'}),
tableName: CUSTOM_EMOJI,
}) as Promise<CustomEmojiModel[]>;
}
};
handleSystem = ({systems, prepareRecordsOnly = true}: HandleSystemArgs) => {
if (!systems.length) {
@@ -77,7 +77,7 @@ export default class ServerDataOperatorBase extends BaseDataOperator {
createOrUpdateRawValues: getUniqueRawsBy({raws: systems, key: 'id'}),
tableName: SYSTEM,
}) as Promise<SystemModel[]>;
}
};
handleTermOfService = ({termOfService, prepareRecordsOnly = true}: HandleTOSArgs) => {
if (!termOfService.length) {
@@ -94,29 +94,29 @@ export default class ServerDataOperatorBase extends BaseDataOperator {
createOrUpdateRawValues: getUniqueRawsBy({raws: termOfService, key: 'id'}),
tableName: TERMS_OF_SERVICE,
}) as Promise<TermsOfServiceModel[]>;
}
};
/**
* execute: Handles the Create/Update operations on an table.
* @param {OperationArgs} execute
* @param {string} execute.tableName
* @param {RecordValue[]} execute.createRaws
* @param {RecordValue[]} execute.updateRaws
* @param {(TransformerArgs) => Promise<Model>} execute.recordOperator
* @returns {Promise<void>}
*/
execute = async ({createRaws, transformer, tableName, updateRaws}: OperationArgs): Promise<Model[]> => {
const models = await this.prepareRecords({
tableName,
createRaws,
updateRaws,
transformer,
});
/**
* execute: Handles the Create/Update operations on an table.
* @param {OperationArgs} execute
* @param {string} execute.tableName
* @param {RecordValue[]} execute.createRaws
* @param {RecordValue[]} execute.updateRaws
* @param {(TransformerArgs) => Promise<Model>} execute.recordOperator
* @returns {Promise<void>}
*/
execute = async ({createRaws, transformer, tableName, updateRaws}: OperationArgs): Promise<Model[]> => {
const models = await this.prepareRecords({
tableName,
createRaws,
updateRaws,
transformer,
});
if (models?.length > 0) {
await this.batchRecords(models);
}
if (models?.length > 0) {
await this.batchRecords(models);
}
return models;
};
return models;
};
}

View File

@@ -200,7 +200,7 @@ const PostHandler = (superclass: any) => class extends superclass {
if (batch.length) {
await this.batchRecords(batch);
}
}
};
/**
* handleFiles: Handler responsible for the Create/Update operations occurring on the File table from the 'Server' schema

View File

@@ -54,7 +54,7 @@ const PostsInChannelHandler = (superclass: any) => class extends superclass {
}
return result;
}
};
handleReceivedPostsInChannel = async (posts: Post[], prepareRecordsOnly = false): Promise<PostsInChannelModel[]> => {
if (!posts.length) {
@@ -168,11 +168,11 @@ const PostsInChannelHandler = (superclass: any) => class extends superclass {
handleReceivedPostsInChannelBefore = async (posts: Post[], prepareRecordsOnly = false): Promise<PostsInChannelModel[]> => {
throw new Error(`handleReceivedPostsInChannelBefore Not implemented yet. posts count${posts.length} prepareRecordsOnly=${prepareRecordsOnly}`);
}
};
handleReceivedPostsInChannelAfter = async (posts: Post[], prepareRecordsOnly = false): Promise<PostsInChannelModel[]> => {
throw new Error(`handleReceivedPostsInChannelAfter Not implemented yet. posts count${posts.length} prepareRecordsOnly=${prepareRecordsOnly}`);
}
};
handleReceivedPostForChannel = async (posts: Post[], prepareRecordsOnly = false): Promise<PostsInChannelModel[]> => {
if (!posts.length) {
@@ -221,7 +221,7 @@ const PostsInChannelHandler = (superclass: any) => class extends superclass {
}
return targetChunk;
}
};
};
export default PostsInChannelHandler;

View File

@@ -72,7 +72,7 @@ class GlobalEventHandler {
} catch (error) {
// Nothing to clear
}
}
};
clearCookiesForServer = async (serverUrl: string) => {
this.clearCookies(serverUrl, false);
@@ -149,7 +149,7 @@ class GlobalEventHandler {
} else {
resetMomentLocale();
}
}
};
serverUpgradeNeeded = async (serverUrl: string) => {
const credentials = await getServerCredentials(serverUrl);

View File

@@ -39,7 +39,7 @@ class ManagedApp {
Emm.setAppGroupId(appGroupIdentifier);
}
}
}
};
processConfig = async (config?: ManagedConfig) => {
// If the managed configuration changed while authentication was

View File

@@ -58,12 +58,12 @@ class NetworkManager {
console.log('NetworkManager init error', error); //eslint-disable-line no-console
}
}
}
};
public invalidateClient = (serverUrl: string) => {
this.clients[serverUrl]?.invalidate();
delete this.clients[serverUrl];
}
};
public getClient = (serverUrl: string) => {
const client = this.clients[serverUrl];
@@ -72,7 +72,7 @@ class NetworkManager {
}
return client;
}
};
public createClient = async (serverUrl: string, bearerToken?: string) => {
const config = await this.buildConfig();
@@ -81,7 +81,7 @@ class NetworkManager {
this.clients[serverUrl] = new Client(client, serverUrl, bearerToken, csrfToken);
return this.clients[serverUrl];
}
};
private buildConfig = async () => {
const userAgent = await DeviceInfo.getUserAgent();
@@ -107,7 +107,7 @@ class NetworkManager {
}
return config;
}
};
private clientErrorEventHandler: APIClientErrorEventHandler = (event: APIClientErrorEvent) => {
if (CLIENT_CERTIFICATE_IMPORT_ERROR_CODES.includes(event.errorCode)) {

View File

@@ -91,7 +91,7 @@ class PushNotifications {
Notifications.ios.setBadgeCount(badgeCount);
}
}
}
};
createReplyCategory = () => {
const replyTitle = getLocalizedMessage(DEFAULT_LOCALE, t('mobile.push_notification_reply.title'));
@@ -115,7 +115,7 @@ class PushNotifications {
}
return serverUrl;
}
};
handleClearNotification = async (notification: NotificationWithData) => {
const {payload} = notification;
@@ -124,7 +124,7 @@ class PushNotifications {
if (serverUrl && payload?.channel_id) {
markChannelAsViewed(serverUrl, payload?.channel_id, false);
}
}
};
handleInAppNotification = async (serverUrl: string, notification: NotificationWithData) => {
const {payload} = notification;
@@ -178,7 +178,7 @@ class PushNotifications {
backgroundNotification(serverUrl, notification);
}
}
}
};
handleSessionNotification = async (notification: NotificationWithData) => {
// eslint-disable-next-line no-console
@@ -189,7 +189,7 @@ class PushNotifications {
if (serverUrl) {
DeviceEventEmitter.emit(Events.SERVER_LOGOUT, serverUrl);
}
}
};
processNotification = async (notification: NotificationWithData) => {
const {payload} = notification;

View File

@@ -46,13 +46,13 @@ class WebsocketManager {
AppState.addEventListener('change', this.onAppStateChange);
NetInfo.addEventListener(this.onNetStateChange);
}
};
public invalidateClient = (serverUrl: string) => {
this.clients[serverUrl]?.close();
this.clients[serverUrl]?.invalidate();
delete this.clients[serverUrl];
}
};
public createClient = (serverUrl: string, bearerToken: string, storedLastDisconnect = 0) => {
const client = new WebSocketClient(serverUrl, bearerToken, storedLastDisconnect);
@@ -70,13 +70,13 @@ class WebsocketManager {
this.clients[serverUrl] = client;
return this.clients[serverUrl];
}
};
public closeAll = () => {
for (const client of Object.values(this.clients)) {
client.close(true);
}
}
};
public openAll = () => {
for (const client of Object.values(this.clients)) {
@@ -84,21 +84,21 @@ class WebsocketManager {
client.initialize();
}
}
}
};
public isConnected = (serverUrl: string): boolean => {
return this.clients[serverUrl]?.isConnected();
}
};
private onFirstConnect = (serverUrl: string) => {
this.startPeriodicStatusUpdates(serverUrl);
handleFirstConnect(serverUrl);
}
};
private onReconnect = (serverUrl: string) => {
this.startPeriodicStatusUpdates(serverUrl);
handleReconnect(serverUrl);
}
};
private onWebsocketClose = async (serverUrl: string, connectFailCount: number, lastDisconnect: number) => {
if (connectFailCount <= 1) { // First fail
@@ -107,7 +107,7 @@ class WebsocketManager {
this.stopPeriodicStatusUpdates(serverUrl);
}
}
};
private startPeriodicStatusUpdates(serverUrl: string) {
let currentId = this.statusUpdatesIntervalIDs[serverUrl];
@@ -163,7 +163,7 @@ class WebsocketManager {
}
this.previousAppState = appState;
}
};
private onNetStateChange = async (netState: NetInfoState) => {
const newState = Boolean(netState.isConnected);
@@ -179,7 +179,7 @@ class WebsocketManager {
}
this.closeAll();
}
};
}
export default new WebsocketManager();

View File

@@ -120,7 +120,7 @@ class ClearAfterModal extends NavigationComponent<Props, State> {
}
return true;
}
};
onDone = () => {
const {handleClearAfterClick, isModal} = this.props;

View File

@@ -1,6 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import qs from 'querystring';
import React, {useEffect, useState} from 'react';
import {useIntl} from 'react-intl';
import {Linking, Platform, Text, View} from 'react-native';
@@ -74,10 +76,11 @@ const SSOWithRedirectURL = ({doSSOLogin, loginError, loginUrl, serverUrl, setLog
NetworkManager.createClient(serverUrl);
}
const parsedUrl = urlParse(loginUrl, true);
parsedUrl.set('query', {
const query: Record<string, string> = {
...parsedUrl.query,
redirect_to: redirectUrl,
});
};
parsedUrl.set('query', qs.stringify(query));
const url = parsedUrl.toString();
const onError = (e: Error) => {

View File

@@ -119,7 +119,7 @@ const SSOWithWebView = ({completeUrlPath, doSSOLogin, loginError, loginUrl, serv
}
};
const extractCookie = (parsedUrl: urlParse) => {
const extractCookie = (parsedUrl: urlParse<string>) => {
try {
const original = urlParse(serverUrl);

View File

@@ -6,7 +6,7 @@ class EphemeralStore {
navigationComponentIdStack: string[] = [];
navigationModalStack: string[] = [];
theme: Theme | undefined;
visibleTab = 'Home'
visibleTab = 'Home';
addNavigationComponentId = (componentId: string) => {
this.addToNavigationComponentIdStack(componentId);
@@ -17,7 +17,7 @@ class EphemeralStore {
if (!this.allNavigationComponentIds.includes(componentId)) {
this.allNavigationComponentIds.unshift(componentId);
}
}
};
addToNavigationComponentIdStack = (componentId: string) => {
const index = this.navigationComponentIdStack.indexOf(componentId);
@@ -26,11 +26,11 @@ class EphemeralStore {
}
this.navigationComponentIdStack.unshift(componentId);
}
};
addNavigationModal = (componentId: string) => {
this.navigationModalStack.unshift(componentId);
}
};
clearNavigationComponents = () => {
this.navigationComponentIdStack = [];
@@ -40,21 +40,21 @@ class EphemeralStore {
clearNavigationModals = () => {
this.navigationModalStack = [];
}
};
getAllNavigationComponents = () => this.allNavigationComponentIds;
getNavigationTopComponentId = () => {
return this.navigationComponentIdStack[0];
}
};
getNavigationTopModalId = () => {
return this.navigationModalStack[0];
}
};
getNavigationComponents = () => {
return this.navigationComponentIdStack;
}
};
getVisibleTab = () => this.visibleTab;
@@ -65,7 +65,7 @@ class EphemeralStore {
if (index >= 0) {
this.navigationComponentIdStack.splice(index, 1);
}
}
};
removeNavigationModal = (componentId: string) => {
const index = this.navigationModalStack.indexOf(componentId);
@@ -73,11 +73,11 @@ class EphemeralStore {
if (index >= 0) {
this.navigationModalStack.splice(index, 1);
}
}
};
setVisibleTap = (tab: string) => {
this.visibleTab = tab;
}
};
/**
* Waits until a screen has been mounted and is part of the stack.
@@ -94,7 +94,7 @@ class EphemeralStore {
found = this.navigationComponentIdStack.includes(componentId);
}
}
};
/**
* Waits until a screen has been removed as part of the stack.
@@ -111,7 +111,7 @@ class EphemeralStore {
found = !this.navigationComponentIdStack.includes(componentId);
}
}
};
}
export default new EphemeralStore();

3546
detox/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,22 +4,22 @@
"repository": "git@github.com:mattermost/mattermost-mobile.git",
"author": "Mattermost, Inc.",
"devDependencies": {
"@babel/plugin-proposal-class-properties": "7.14.5",
"@babel/plugin-transform-modules-commonjs": "7.15.4",
"@babel/plugin-transform-runtime": "7.15.0",
"@babel/preset-env": "7.15.6",
"axios": "0.21.4",
"babel-jest": "27.2.1",
"@babel/plugin-proposal-class-properties": "7.16.0",
"@babel/plugin-transform-modules-commonjs": "7.16.0",
"@babel/plugin-transform-runtime": "7.16.4",
"@babel/preset-env": "7.16.4",
"axios": "0.24.0",
"babel-jest": "27.3.1",
"babel-plugin-module-resolver": "4.1.0",
"client-oauth2": "github:larkox/js-client-oauth2#e24e2eb5dfcbbbb3a59d095e831dbe0012b0ac49",
"deepmerge": "4.2.2",
"detox": "18.20.4",
"detox": "19.1.0",
"form-data": "4.0.0",
"jest": "27.2.1",
"jest-circus": "27.2.1",
"jest-cli": "27.2.1",
"jest": "27.3.1",
"jest-circus": "27.3.1",
"jest-cli": "27.3.1",
"jest-html-reporters": "2.1.6",
"jest-junit": "12.3.0",
"jest-junit": "13.0.0",
"sanitize-filename": "1.6.3",
"uuid": "8.3.2"
},

3637
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@
"license": "Apache 2.0",
"private": true,
"dependencies": {
"@babel/runtime": "7.16.0",
"@babel/runtime": "7.16.3",
"@formatjs/intl-datetimeformat": "4.2.5",
"@formatjs/intl-getcanonicallocales": "1.8.0",
"@formatjs/intl-locale": "2.4.40",
@@ -19,17 +19,17 @@
"@mattermost/react-native-paste-input": "0.3.4",
"@nozbe/watermelondb": "0.24.0",
"@nozbe/with-observables": "1.4.0",
"@react-native-async-storage/async-storage": "1.15.11",
"@react-native-async-storage/async-storage": "1.15.13",
"@react-native-community/art": "1.2.0",
"@react-native-community/cameraroll": "4.1.2",
"@react-native-community/clipboard": "1.5.1",
"@react-native-community/datetimepicker": "3.5.2",
"@react-native-community/datetimepicker": "4.0.0",
"@react-native-community/masked-view": "0.1.11",
"@react-native-community/netinfo": "6.0.6",
"@react-native-community/netinfo": "7.1.2",
"@react-native-cookies/cookies": "6.0.11",
"@react-navigation/bottom-tabs": "6.0.9",
"@react-navigation/native": "6.0.6",
"@rudderstack/rudder-sdk-react-native": "1.0.15",
"@rudderstack/rudder-sdk-react-native": "1.1.0",
"@sentry/react-native": "3.2.3",
"@types/mime-db": "1.43.1",
"commonmark": "0.30.0",
@@ -37,20 +37,21 @@
"deep-equal": "2.0.5",
"deepmerge": "4.2.2",
"emoji-regex": "10.0.0",
"expo": "43.0.3",
"fuse.js": "6.4.6",
"jail-monkey": "2.6.0",
"lottie-ios": "3.2.3",
"lottie-react-native": "4.1.3",
"mime-db": "1.50.0",
"moment-timezone": "0.5.33",
"lottie-react-native": "5.0.1",
"mime-db": "1.51.0",
"moment-timezone": "0.5.34",
"prop-types": "15.7.2",
"react": "17.0.2",
"react-intl": "5.21.0",
"react-native": "0.66.2",
"react-intl": "5.22.0",
"react-native": "0.66.3",
"react-native-android-open-settings": "1.3.0",
"react-native-button": "3.0.1",
"react-native-calendars": "1.1268.0",
"react-native-device-info": "8.4.5",
"react-native-calendars": "1.1269.0",
"react-native-device-info": "8.4.8",
"react-native-document-picker": "7.1.1",
"react-native-elements": "3.4.2",
"react-native-exception-handler": "2.10.10",
@@ -64,39 +65,39 @@
"react-native-keychain": "8.0.0",
"react-native-linear-gradient": "2.5.6",
"react-native-localize": "2.1.5",
"react-native-navigation": "7.23.1",
"react-native-navigation": "7.23.1-hotfix.1",
"react-native-neomorph-shadows": "1.1.2",
"react-native-notifications": "4.1.2",
"react-native-permissions": "3.1.0",
"react-native-reanimated": "2.2.3",
"react-native-redash": "16.2.2",
"react-native-reanimated": "2.2.4",
"react-native-redash": "16.2.3",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "3.9.0",
"react-native-section-list-get-item-layout": "2.2.3",
"react-native-share": "7.2.1",
"react-native-share": "7.3.0",
"react-native-slider": "0.11.0",
"react-native-svg": "12.1.1",
"react-native-vector-icons": "9.0.0",
"react-native-video": "5.2.0",
"react-native-webview": "11.14.2",
"react-native-webview": "11.15.0",
"react-native-youtube": "2.0.2",
"reanimated-bottom-sheet": "1.0.0-alpha.22",
"rn-placeholder": "3.0.3",
"semver": "7.3.5",
"serialize-error": "8.1.0",
"serialize-error": "9.0.0",
"shallow-equals": "1.0.0",
"tinycolor2": "1.4.2",
"url-parse": "1.5.3",
"expo": ">=43.0.0-* <44.0.0"
"url-parse": "1.5.3"
},
"devDependencies": {
"@babel/cli": "7.16.0",
"@babel/core": "7.16.0",
"@babel/eslint-parser": "7.16.3",
"@babel/plugin-proposal-class-properties": "7.16.0",
"@babel/plugin-proposal-decorators": "7.16.0",
"@babel/plugin-proposal-decorators": "7.16.4",
"@babel/plugin-transform-flow-strip-types": "7.16.0",
"@babel/plugin-transform-runtime": "7.16.0",
"@babel/preset-env": "7.16.0",
"@babel/plugin-transform-runtime": "7.16.4",
"@babel/preset-env": "7.16.4",
"@babel/preset-typescript": "7.16.0",
"@babel/register": "7.16.0",
"@react-native-community/eslint-config": "3.0.1",
@@ -104,35 +105,33 @@
"@types/commonmark": "0.27.5",
"@types/commonmark-react-renderer": "4.3.1",
"@types/deep-equal": "1.0.1",
"@types/jest": "27.0.2",
"@types/lodash": "4.14.176",
"@types/react": "17.0.34",
"@types/react-intl": "3.0.0",
"@types/react-native": "0.66.2",
"@types/jest": "27.0.3",
"@types/lodash": "4.14.177",
"@types/react": "17.0.37",
"@types/react-native": "0.66.6",
"@types/react-native-button": "3.0.1",
"@types/react-native-share": "3.3.3",
"@types/react-native-video": "5.0.10",
"@types/react-native-video": "5.0.11",
"@types/react-test-renderer": "17.0.1",
"@types/semver": "7.3.9",
"@types/shallow-equals": "1.0.0",
"@types/tinycolor2": "1.4.3",
"@types/url-parse": "1.4.4",
"@typescript-eslint/eslint-plugin": "5.3.0",
"@typescript-eslint/parser": "5.3.0",
"babel-eslint": "10.1.0",
"@types/url-parse": "1.4.5",
"@typescript-eslint/eslint-plugin": "5.4.0",
"@typescript-eslint/parser": "5.4.0",
"babel-jest": "27.3.1",
"babel-loader": "8.2.3",
"babel-plugin-module-resolver": "4.1.0",
"babel-plugin-transform-remove-console": "6.9.4",
"deep-freeze": "0.0.1",
"detox": "19.0.0",
"eslint": "7.32.0",
"detox": "19.1.0",
"eslint": "8.3.0",
"eslint-plugin-header": "3.1.1",
"eslint-plugin-import": "2.25.2",
"eslint-plugin-jest": "25.2.3",
"eslint-plugin-mattermost": "github:mattermost/eslint-plugin-mattermost#46ad99355644a719bf32082f472048f526605181",
"eslint-plugin-react": "7.26.1",
"eslint-plugin-react-hooks": "4.2.0",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-jest": "25.3.0",
"eslint-plugin-mattermost": "github:mattermost/eslint-plugin-mattermost#23abcf9988f7fa00d26929f11841aab7ccb16b2b",
"eslint-plugin-react": "7.27.1",
"eslint-plugin-react-hooks": "4.3.0",
"husky": "7.0.4",
"isomorphic-fetch": "3.0.0",
"jest": "27.3.1",
@@ -141,7 +140,7 @@
"metro-react-native-babel-preset": "0.66.2",
"mmjstool": "github:mattermost/mattermost-utilities#519b99a4e51e6c67a0dbd46a6efdff27dc835aaa",
"mock-async-storage": "2.2.0",
"nock": "13.1.4",
"nock": "13.2.1",
"patch-package": "6.4.7",
"react-native-dev-menu": "4.0.2",
"react-native-dotenv": "3.3.0",
@@ -149,7 +148,7 @@
"react-native-svg-transformer": "0.14.3",
"react-test-renderer": "17.0.2",
"ts-jest": "27.0.7",
"typescript": "4.4.4",
"typescript": "4.5.2",
"underscore": "1.13.1",
"util": "0.12.4"
},
@@ -194,7 +193,14 @@
},
"expo": {
"autolinking": {
"exclude": ["expo-keep-awake", "expo-font", "expo-constants", "expo-application", "expo-assets", "expo-error-recovery"]
"exclude": [
"expo-keep-awake",
"expo-font",
"expo-constants",
"expo-application",
"expo-assets",
"expo-error-recovery"
]
}
}
}

View File

@@ -0,0 +1,26 @@
diff --git a/node_modules/react-native-reanimated/lib/reanimated2/js-reanimated/index.web.js b/node_modules/react-native-reanimated/lib/reanimated2/js-reanimated/index.web.js
index 4ab9d7e..67b2060 100644
--- a/node_modules/react-native-reanimated/lib/reanimated2/js-reanimated/index.web.js
+++ b/node_modules/react-native-reanimated/lib/reanimated2/js-reanimated/index.web.js
@@ -11,7 +11,7 @@ export const _updatePropsJS = (_viewTag, _viewName, updates, viewRef) => {
acc[index][key] = value;
return acc;
}, [{}, {}]);
- setNativeProps(viewRef._component, rawStyles);
+ setNativeProps(viewRef.current._component, rawStyles);
}
};
const setNativeProps = (component, style) => {
diff --git a/node_modules/react-native-reanimated/src/reanimated2/js-reanimated/index.web.ts b/node_modules/react-native-reanimated/src/reanimated2/js-reanimated/index.web.ts
index 46de206..58126f2 100644
--- a/node_modules/react-native-reanimated/src/reanimated2/js-reanimated/index.web.ts
+++ b/node_modules/react-native-reanimated/src/reanimated2/js-reanimated/index.web.ts
@@ -18,7 +18,7 @@ export const _updatePropsJS = (_viewTag, _viewName, updates, viewRef) => {
[{}, {}]
);
- setNativeProps(viewRef._component, rawStyles);
+ setNativeProps(viewRef.current._component, rawStyles);
}
};

View File

@@ -62,7 +62,7 @@ class TestHelper {
await operator.batchRecords(systems);
return {database, operator};
}
};
activateMocking() {
if (!nock.isActive()) {
@@ -128,7 +128,7 @@ class TestHelper {
id: this.generateId(),
delete_at: 0,
};
}
};
fakeChannelMember = (userId, channelId) => {
return {
@@ -289,26 +289,6 @@ class TestHelper {
update_at: 1507840900004,
delete_at: 0,
};
}
generateId = () => {
// Implementation taken from http://stackoverflow.com/a/2117523
let id = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
id = id.replace(/[xy]/g, (c) => {
const r = Math.floor(Math.random() * 16);
let v;
if (c === 'x') {
v = r;
} else {
v = (r & 0x3) | 0x8;
}
return v.toString(16);
});
return 'uid' + id;
};
mockLogin = () => {
@@ -331,7 +311,7 @@ class TestHelper {
nock(this.basicClient4.getBaseRoute()).
get('/users/me/preferences').
reply(200, [{user_id: this.basicUser.id, category: 'tutorial_step', name: this.basicUser.id, value: '999'}]);
}
};
initMockEntities = () => {
this.basicUser = this.fakeUserWithId();
@@ -410,7 +390,7 @@ class TestHelper {
},
};
this.basicScheme = this.mockSchemeWithId();
}
};
initBasic = async (client = this.createClient()) => {
client.setUrl(Config.TestServerUrl || Config.DefaultServerUrl);
@@ -481,7 +461,7 @@ class TestHelper {
description: '',
content_type: 'application/x-www-form-urlencoded',
};
}
};
testCommand = (teamId) => {
return {
@@ -514,9 +494,9 @@ class TestHelper {
this.basicChannel = null;
this.basicChannelMember = null;
this.basicPost = null;
}
};
wait = (time) => new Promise((resolve) => setTimeout(resolve, time))
wait = (time) => new Promise((resolve) => setTimeout(resolve, time));
}
export default new TestHelper();