Barebones code for v2

This commit is contained in:
Elias Nahum
2020-11-14 11:06:43 -03:00
commit 22e82dfc2a
444 changed files with 75871 additions and 0 deletions

10
types/api/client_error.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
interface ClientErrorProps extends Error {
details: Error;
intl?: {defaultMessage?: string; id: string;} | { defaultMessage?: string; id: string } | { id: string; defaultMessage?: string; values: any } | { id: string; defaultMessage?: string };
url: string;
server_error_id?: string | number;
status_code?: number;
}

167
types/api/config.d.ts vendored Normal file
View File

@@ -0,0 +1,167 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
interface ClientConfig {
AboutLink: string;
AllowBannerDismissal: string;
AllowCustomThemes: string;
AllowedThemes: string;
AndroidAppDownloadLink: string;
AndroidLatestVersion: string;
AndroidMinVersion: string;
AppDownloadLink: string;
AsymmetricSigningPublicKey: string;
AvailableLocales: string;
BannerColor: string;
BannerText: string;
BannerTextColor: string;
BuildDate: string;
BuildEnterpriseReady: string;
BuildHash: string;
BuildHashEnterprise: string;
BuildNumber: string;
CloseUnusedDirectMessages: string;
CustomBrandText: string;
CustomDescriptionText: string;
CustomTermsOfServiceId: string;
CustomTermsOfServiceReAcceptancePeriod: string;
CustomUrlSchemes: string;
DataRetentionEnableFileDeletion: string;
DataRetentionEnableMessageDeletion: string;
DataRetentionFileRetentionDays: string;
DataRetentionMessageRetentionDays: string;
DefaultClientLocale: string;
DefaultTheme: string;
DesktopLatestVersion: string;
DesktopMinVersion: string;
DiagnosticId: string;
DiagnosticsEnabled: string;
EmailLoginButtonBorderColor: string;
EmailLoginButtonColor: string;
EmailLoginButtonTextColor: string;
EmailNotificationContentsType: string;
EnableBanner: string;
EnableBotAccountCreation: string;
EnableChannelViewedMessages: string;
EnableCluster: string;
EnableCommands: string;
EnableCompliance: string;
EnableConfirmNotificationsToChannel: string;
EnableCustomBrand: string;
EnableCustomEmoji: string;
EnableCustomTermsOfService: string;
EnableDeveloper: string;
EnableDiagnostics: string;
EnableEmailBatching: string;
EnableEmailInvitations: string;
EnableEmojiPicker: string;
EnableFileAttachments: string;
EnableGifPicker: string;
EnableGuestAccounts: string;
EnableIncomingWebhooks: string;
EnableLatex: string;
EnableLdap: string;
EnableLinkPreviews: string;
EnableMarketplace: string;
EnableMetrics: string;
EnableMobileFileDownload: string;
EnableMobileFileUpload: string;
EnableMultifactorAuthentication: string;
EnableOAuthServiceProvider: string;
EnableOpenServer: string;
EnableOutgoingWebhooks: string;
EnablePostIconOverride: string;
EnablePostUsernameOverride: string;
EnablePreviewFeatures: string;
EnablePreviewModeBanner: string;
EnablePublicLink: string;
EnableSaml: string;
EnableSignInWithEmail: string;
EnableSignInWithUsername: string;
EnableSignUpWithEmail: string;
EnableSignUpWithGitLab: string;
EnableSignUpWithGoogle: string;
EnableSignUpWithOffice365: string;
EnableSVGs: string;
EnableTesting: string;
EnableThemeSelection: string;
EnableTutorial: string;
EnableUserAccessTokens: string;
EnableUserCreation: string;
EnableUserDeactivation: string;
EnableUserTypingMessages: string;
EnableXToLeaveChannelsFromLHS: string;
EnforceMultifactorAuthentication: string;
ExperimentalChannelOrganization: string;
ExperimentalChannelSidebarOrganization: string;
ExperimentalClientSideCertCheck: string;
ExperimentalClientSideCertEnable: string;
ExperimentalEnableAuthenticationTransfer: string;
ExperimentalEnableAutomaticReplies: string;
ExperimentalEnableClickToReply: string;
ExperimentalEnableDefaultChannelLeaveJoinMessages: string;
ExperimentalEnablePostMetadata: string;
ExperimentalGroupUnreadChannels: string;
ExperimentalHideTownSquareinLHS: string;
ExperimentalPrimaryTeam: string;
ExperimentalTimezone: string;
ExperimentalTownSquareIsReadOnly: string;
ExperimentalViewArchivedChannels: string;
ExtendSessionLengthWithActivity: string;
GfycatApiKey: string;
GfycatApiSecret: string;
GoogleDeveloperKey: string;
GuestAccountsEnforceMultifactorAuthentication: string;
HasImageProxy: string;
HelpLink: string;
IosAppDownloadLink: string;
IosLatestVersion: string;
IosMinVersion: string;
LdapFirstNameAttributeSet: string;
LdapLastNameAttributeSet: string;
LdapLoginButtonBorderColor: string;
LdapLoginButtonColor: string;
LdapLoginButtonTextColor: string;
LdapLoginFieldName: string;
LdapNicknameAttributeSet: string;
LdapPositionAttributeSet: string;
LockTeammateNameDisplay: string;
MaxFileSize: string;
MaxNotificationsPerChannel: string;
MinimumHashtagLength: string;
PasswordMinimumLength: string;
PasswordRequireLowercase: string;
PasswordRequireNumber: string;
PasswordRequireSymbol: string;
PasswordRequireUppercase: string;
PluginsEnabled: string;
PostEditTimeLimit: string;
PrivacyPolicyLink: string;
ReportAProblemLink: string;
RequireEmailVerification: string;
RestrictDirectMessage: string;
RunJobs: string;
SamlFirstNameAttributeSet: string;
SamlLastNameAttributeSet: string;
SamlLoginButtonBorderColor: string;
SamlLoginButtonColor: string;
SamlLoginButtonText: string;
SamlLoginButtonTextColor: string;
SamlNicknameAttributeSet: string;
SamlPositionAttributeSet: string;
SendEmailNotifications: string;
SendPushNotifications: string;
ShowEmailAddress: string;
ShowFullName: string;
SiteName: string;
SiteURL: string;
SQLDriverName: string;
SupportEmail: string;
TeammateNameDisplay: string;
TermsOfServiceLink: string;
TimeBetweenUserTypingUpdatesMilliseconds: string;
Version: string;
WebsocketPort: string;
WebsocketSecurePort: string;
WebsocketURL: string;
}

8
types/global/error_handling.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
interface jsAndNativeErrorHandler {
initializeErrorHandling: () => void;
nativeErrorHandler: (e: string) => void;
errorHandler: (e: Error | ClientError, isFatal: boolean) => void;
}

10
types/global/global_event_handler.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
interface launchAppFunc {
(skipEmm: boolean): void;
}
interface GlobalEventHandlerOpts {
launchApp: launchAppFunc;
}

24
types/global/native_notifications.d.ts vendored Normal file
View File

@@ -0,0 +1,24 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
interface NativeNotificationSound {
name: string;
uri: string;
}
interface NativeNotificationPreferences {
selectedUri?: string;
shouldBlink: boolean;
shouldVibrate: boolean;
sounds: Array<NativeNotificationSound>;
}
interface NativeNotification {
getDeliveredNotifications(): Promise<NotificationWithChannel[]>;
getPreferences(): Promise<NativeNotificationPreferences|null>;
play(soundUri: string): void;
removeDeliveredNotifications(identifier: string | string[], channelId?: string): void;
setNotificationSound(): void;
setShouldBlink(shouldBlink: boolean): void;
setShouldVibrate(shouldVibrate: boolean): void;
}

42
types/global/preferences.d.ts vendored Normal file
View File

@@ -0,0 +1,42 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
interface PreferenceType {
category: string;
name: string;
user_id: string;
value?: string;
}
interface PreferencesType {
[x: string]: PreferenceType;
}
interface Theme {
[key: string]: string | undefined;
type?: string;
sidebarBg: string;
sidebarText: string;
sidebarUnreadText: string;
sidebarTextHoverBg: string;
sidebarTextActiveBorder: string;
sidebarTextActiveColor: string;
sidebarHeaderBg: string;
sidebarHeaderTextColor: string;
onlineIndicator: string;
awayIndicator: string;
dndIndicator: string;
mentionBg: string;
mentionBj: string;
mentionColor: string;
centerChannelBg: string;
centerChannelColor: string;
newMessageSeparator: string;
linkColor: string;
buttonBg: string;
buttonColor: string;
errorTextColor: string;
mentionHighlightBg: string;
mentionHighlightLink: string;
codeTheme: string;
}

47
types/global/push_notifications.d.ts vendored Normal file
View File

@@ -0,0 +1,47 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
declare class Notification {
fireDate?: number | string;
identifier: string;
payload: any;
title: string;
body: string;
sound: string;
badge: number;
type: string;
thread: string;
}
interface NotificationUserInfo {
local: boolean;
test?: boolean;
}
interface NotificationData {
body?: string;
channel_id: string;
channel_name?: string;
from_webhook?: string;
message?: string;
override_icon_url?: string;
override_username?: string;
post_id: string;
root_id?: string;
sender_id?: string;
team_id?: string;
type: string;
use_user_icon?: string;
userInfo?: NotificationUserInfo;
version: string;
}
interface NotificationWithData extends Notification {
payload?: NotificationData;
foreground?: boolean;
userInteraction?: boolean;
}
declare class NotificationWithChannel extends Notification {
channel_id?: string;
}

10
types/global/telemetry.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
interface RudderClient {
setup(key: string, options: any): Promise<void>;
track(event: string, properties: Record<string, any> | undefined, options?: Record<string, any>): void;
identify(userId: string, traits: Record<string, any>, options?: Record<string, any>): Promise<void>;
screen(name: string, properties: Record<string, any> | undefined, options?: Record<string, any>): void;
reset(): Promise<void>;
}

6
types/global/utilities.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
interface Dictionary<T> {
[key: string]: T;
}

134
types/modules/react-native-slider.d.ts vendored Normal file
View File

@@ -0,0 +1,134 @@
/* eslint-disable header/header */
declare module 'react-native-slider' {
import {ComponentClass, PureComponent} from 'react';
import {
ImageSourcePropType,
SpringAnimationConfig,
StyleProp,
TimingAnimationConfig,
ViewStyle,
} from 'react-native';
interface SliderProps {
/**
* Initial value of the slider. The value should be between minimumValue
* and maximumValue, which default to 0 and 1 respectively.
* Default value is 0.
*
* *This is not a controlled component*, e.g. if you don't update
* the value, the component won't be reset to its inital value.
*/
value?: number
/**
* If true the user won't be able to move the slider.
* Default value is false.
*/
disabled?: boolean
/**
* Initial minimum value of the slider. Default value is 0.
*/
minimumValue?: number
/**
* Initial maximum value of the slider. Default value is 1.
*/
maximumValue?: number
/**
* Step value of the slider. The value should be between 0 and
* (maximumValue - minimumValue). Default value is 0.
*/
step?: number
/**
* The color used for the track to the left of the button. Overrides the
* default blue gradient image.
*/
minimumTrackTintColor?: string
/**
* The color used for the track to the right of the button. Overrides the
* default blue gradient image.
*/
maximumTrackTintColor?: string
/**
* The color used for the thumb.
*/
thumbTintColor?: string
/**
* The size of the touch area that allows moving the thumb.
* The touch area has the same center has the visible thumb.
* This allows to have a visually small thumb while still allowing the user
* to move it easily.
* The default is {width: 40, height: 40}.
*/
thumbTouchSize?: { width: number; height: number }
/**
* Callback continuously called while the user is dragging the slider.
*/
onValueChange: (value: number) => void
/**
* Callback called when the user starts changing the value (e.g. when
* the slider is pressed).
*/
onSlidingStart?: (value: number) => void
/**
* Callback called when the user finishes changing the value (e.g. when
* the slider is released).
*/
onSlidingComplete?: (value: number) => void
/**
* The style applied to the slider container.
*/
style?: StyleProp<ViewStyle>
/**
* The style applied to the track.
*/
trackStyle?: StyleProp<ViewStyle>
/**
* The style applied to the thumb.
*/
thumbStyle?: StyleProp<ViewStyle>
/**
* Sets an image for the thumb.
*/
thumbImage?: ImageSourcePropType
/**
* Set this to true to visually see the thumb touch rect in green.
*/
debugTouchArea?: boolean
/**
* Set to true to animate values with default 'timing' animation type
*/
animateTransitions?: boolean
/**
* Custom Animation type. 'spring' or 'timing'.
*/
animationType?: 'spring' | 'timing'
/**
* Used to configure the animation parameters. These are the same parameters in the Animated library.
*/
animationConfig?: SpringAnimationConfig | TimingAnimationConfig
}
const Slider: ComponentClass<SliderProps>;
export default Slider;
}

116
types/screens/gallery.d.ts vendored Normal file
View File

@@ -0,0 +1,116 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {intlShape} from 'react-intl';
import {StyleProp, ViewStyle} from 'react-native';
import Animated from 'react-native-reanimated';
import type {FileInfo} from '@mm-redux/types/files';
import type {Theme} from '@mm-redux/types/preferences';
export interface ActionCallback {
(callback: CallbackFunctionWithoutArguments): void;
}
export interface ActionProps {
action: (callback: CallbackFunctionWithoutArguments) => void;
children: React.ReactNode;
style?: StyleProp<ViewStyle>;
visible: boolean;
}
export interface ActionsProps {
canDownloadFiles: boolean;
downloadAction: ActionCallback;
file: FileInfo;
linkAction: ActionCallback;
}
export interface AvatarProps {
avatarUri?: string;
theme: Theme;
}
export interface CallbackFunctionWithoutArguments {
(): void;
}
export interface DetailsProps {
channel?: string;
isDirect?: boolean;
ownPost?: boolean;
user?: string;
}
export interface PrepareFileRef {
start(file: FileInfo, share?: boolean): Promise<string | undefined>;
}
export interface FooterProps {
intl: typeof intlShape;
file: FileInfo;
}
export interface FooterRef {
toggle(): boolean;
isVisible(): boolean;
}
export interface GalleryProps {
files: Array<FileInfo>;
footerVisible: boolean;
height: number;
initialIndex: number;
isLandscape: boolean;
onClose: CallbackFunctionWithoutArguments;
onPageSelected: (index: number) => void;
onTap: CallbackFunctionWithoutArguments;
width: number;
theme: Theme;
}
export interface GalleryItemProps {
file: FileInfo;
deviceHeight: number;
deviceWidth: number;
intl?: typeof intlShape;
isActive?: boolean;
onDoubleTap?: CallbackFunctionWithoutArguments;
style?: StyleProp<Animated.AnimateStyle>;
theme?: Theme;
}
export interface ManagedConfig {
[key: string]: string;
}
export interface ShowToast {
(text: string, duration?: number, callback?: () => void): void;
}
export interface SummaryProps {
avatarUri?: string;
channelName?: string;
copyPublicLink: ActionCallback;
displayName?: string;
dowloadFile: ActionCallback;
file: FileInfo;
isDirectChannel: boolean;
isLandscape: boolean;
ownPost: boolean;
theme: Theme;
}
export interface ToastProps {
theme: Theme;
}
export interface ToastRef {
show: ShowToast
}
export interface ToastState {
animation?: CompositeAnimation,
duration?: number;
callback?: () => void;
}