* Apps bindings support (#5012) * Add redux related information * Add binding loading on channel refresh * Add channel header and post option bindings * Fix test * Minor fixes * Fix snapshots * Handle errors and show bindings only on main channel * Update Expand Levels keys and values to match latest changes * Add NAVIGATE call response handling. * Add more isolation to apps related code * Add defaults to send ephemeral * Update variable naming * Rename shouldProcessApps by a more meaningful appsEnabled * Embedded forms (#5169) * Add redux related information * Add binding loading on channel refresh * Add channel header and post option bindings * Fix test * Minor fixes * Fix snapshots * Handle errors and show bindings only on main channel * Update Expand Levels keys and values to match latest changes * Add NAVIGATE call response handling. * Add more isolation to apps related code * Add Embedded Forms * Fix snapshots * Add Embedded Forms * Improve naming, change the root element to be a binding and improve binding handling * Get post down on the buttons, remove unneeded variables and minor fixes from the review * Allow undefined bindings to fillBindingsInformation and add logging for error. * Address review feedback * Add App Forms (#5177) * Add App Forms * Address feedback and self review * Add dynamic select * Fixes and improvements * Add the ability to refresh on submit. * Use AppFormValue instead of redoing the type * Address feedback * [MM-31508] Rename URL to Path in Call (#5186) * Add user agent to call context (#5193) * Remove unneeded state reference (#5196) * Change user agent query on fetch bindings (#5201) * Add refresh websocket event to refetch bindings (#5194) * Add refresh websocket event to refetch bindings * Add missing changes * Declare socket event constant and separate the handler to a different function * Add binding validation on binding fetch (#5200) * Apps commands (#5107) * Add redux related information * Add binding loading on channel refresh * Add channel header and post option bindings * Fix test * Minor fixes * Fix snapshots * apps modals draft * Handle errors and show bindings only on main channel * Update Expand Levels keys and values to match latest changes * Add NAVIGATE call response handling. * Add more isolation to apps related code * reuse command parser throughout slash_suggestion component's lifecycle * fix prop and lint * using alert to show error message. need another way * duplicate import * types * types * types * rename file * copy webapp parser and test * dependencies moved. tests pass * move app command parser into its own folder * converted to typescript, all tests are passing * automated and manual tests work * lint * lint * remove fall throughs with blocks * types * doAppCall type * extract displayError to deps file * test types * lint * fix tests * unused import * PR feedback * fix imports and show errors * types * remove execute suggestion for mobile * watch feature flag * fix tests * change form text arugment behavior to show user input and not hint * return call response error in doAppCall * update tests to remove hint from text field suggestions * lint * use new base command structure * fix tests * wrap appsEnabled * typescript actions/command.ts * update app constants * PR feedback * fix error handling from doAppCall action * Use App CallRequest structure (#5212) * error handling * move test files * remove unused import Co-authored-by: Daniel Espino García <larkox@gmail.com> * Add feature flag (#5207) * Add feature flag * Simplify return * Add localization, call validation and use call type on subpath (#5221) * Add localization, call validation and use call type on subpath * Add more localization to the parser and bring fixes from webapp * Fix ephemerals and channel header / post options crashes * fix app command parser deps and alert messages * Improve suggestion handling * Fix test * Fix lint * Return errors as error * Address PR feedback * return error property * fix error string wordings Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com> * migrate app selector to AutocompleteSelector * add if statement to avoid missing prop * add tests for dynamic values * clean up * remove old files Co-authored-by: Daniel Espino García <larkox@gmail.com> Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
146 lines
3.7 KiB
JavaScript
146 lines
3.7 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Platform} from 'react-native';
|
|
import DeviceInfo from 'react-native-device-info';
|
|
|
|
import keyMirror from '@mm-redux/utils/key_mirror';
|
|
|
|
// The iPhone 11 and iPhone 11 Pro Max have a navbar height of 44 and iPhone 11 Pro has 32
|
|
const IPHONE_11_LANDSCAPE_HEIGHT = ['iPhone 11', 'iPhone 11 Pro Max'];
|
|
|
|
export const UpgradeTypes = {
|
|
CAN_UPGRADE: 'can_upgrade',
|
|
MUST_UPGRADE: 'must_upgrade',
|
|
NO_UPGRADE: 'no_upgrade',
|
|
IS_BETA: 'is_beta',
|
|
};
|
|
|
|
export const SidebarSectionTypes = {
|
|
UNREADS: 'unreads',
|
|
FAVORITE: 'favorite',
|
|
PUBLIC: 'public',
|
|
PRIVATE: 'private',
|
|
DIRECT: 'direct',
|
|
RECENT_ACTIVITY: 'recent',
|
|
ALPHA: 'alpha',
|
|
};
|
|
|
|
export const NotificationLevels = {
|
|
DEFAULT: 'default',
|
|
ALL: 'all',
|
|
MENTION: 'mention',
|
|
NONE: 'none',
|
|
};
|
|
|
|
export const NOTIFY_ALL_MEMBERS = 5;
|
|
export const INDICATOR_BAR_HEIGHT = 38;
|
|
|
|
export const CHANNEL_ITEM_LARGE_BADGE_MAX_WIDTH = 38;
|
|
export const CHANNEL_ITEM_SMALL_BADGE_MAX_WIDTH = 32;
|
|
export const LARGE_BADGE_MAX_WIDTH = 30;
|
|
export const SMALL_BADGE_MAX_WIDTH = 26;
|
|
export const MAX_BADGE_RIGHT_POSITION = -13;
|
|
export const LARGE_BADGE_RIGHT_POSITION = -11;
|
|
export const SMALL_BADGE_RIGHT_POSITION = -9;
|
|
|
|
const ViewTypes = keyMirror({
|
|
DATA_CLEANUP: null,
|
|
SERVER_URL_CHANGED: null,
|
|
|
|
POST_DRAFT_CHANGED: null,
|
|
COMMENT_DRAFT_CHANGED: null,
|
|
SEARCH_DRAFT_CHANGED: null,
|
|
|
|
POST_DRAFT_SELECTION_CHANGED: null,
|
|
COMMENT_DRAFT_SELECTION_CHANGED: null,
|
|
|
|
NOTIFICATION_IN_APP: null,
|
|
|
|
SET_POST_DRAFT: null,
|
|
SET_COMMENT_DRAFT: null,
|
|
|
|
SET_TEMP_UPLOAD_FILES_FOR_POST_DRAFT: null,
|
|
RETRY_UPLOAD_FILE_FOR_POST: null,
|
|
|
|
CLEAR_FILES_FOR_POST_DRAFT: null,
|
|
CLEAR_FAILED_FILES_FOR_POST_DRAFT: null,
|
|
|
|
REMOVE_FILE_FROM_POST_DRAFT: null,
|
|
REMOVE_LAST_FILE_FROM_POST_DRAFT: null,
|
|
|
|
SET_CHANNEL_LOADER: null,
|
|
SET_CHANNEL_REFRESHING: null,
|
|
SET_CHANNEL_RETRY_FAILED: null,
|
|
SET_CHANNEL_DISPLAY_NAME: null,
|
|
|
|
REMOVE_LAST_CHANNEL_FOR_TEAM: null,
|
|
|
|
GITLAB: null,
|
|
GOOGLE: null,
|
|
OFFICE365: null,
|
|
OPENID: null,
|
|
SAML: null,
|
|
|
|
SET_INITIAL_POST_VISIBILITY: null,
|
|
RECEIVED_FOCUSED_POST: null,
|
|
LOADING_POSTS: null,
|
|
SET_LOAD_MORE_POSTS_VISIBLE: null,
|
|
|
|
RECEIVED_POSTS_FOR_CHANNEL_AT_TIME: null,
|
|
|
|
SET_LAST_UPGRADE_CHECK: null,
|
|
|
|
ADD_RECENT_EMOJI: null,
|
|
ADD_RECENT_EMOJI_ARRAY: null,
|
|
ANNOUNCEMENT_BANNER: null,
|
|
|
|
INCREMENT_EMOJI_PICKER_PAGE: null,
|
|
|
|
SET_DEEP_LINK_URL: null,
|
|
|
|
SET_PROFILE_IMAGE_URI: null,
|
|
|
|
SELECTED_ACTION_MENU: null,
|
|
SUBMIT_ATTACHMENT_MENU_ACTION: null,
|
|
|
|
PORTRAIT: null,
|
|
LANDSCAPE: null,
|
|
|
|
INDICATOR_BAR_VISIBLE: null,
|
|
CHANNEL_NAV_BAR_CHANGED: null,
|
|
});
|
|
|
|
const RequiredServer = {
|
|
FULL_VERSION: 5.25,
|
|
MAJOR_VERSION: 5,
|
|
MIN_VERSION: 25,
|
|
PATCH_VERSION: 0,
|
|
};
|
|
|
|
export default {
|
|
...ViewTypes,
|
|
RequiredServer,
|
|
POST_VISIBILITY_CHUNK_SIZE: Platform.OS === 'android' ? 15 : 60,
|
|
FEATURE_TOGGLE_PREFIX: 'feature_enabled_',
|
|
EMBED_PREVIEW: 'embed_preview',
|
|
LINK_PREVIEW_DISPLAY: 'link_previews',
|
|
MIN_CHANNELNAME_LENGTH: 2,
|
|
MAX_CHANNELNAME_LENGTH: 64,
|
|
ANDROID_TOP_LANDSCAPE: 46,
|
|
ANDROID_TOP_PORTRAIT: 56,
|
|
IOS_TOP_LANDSCAPE: IPHONE_11_LANDSCAPE_HEIGHT.includes(DeviceInfo.getModel()) ? 44 : 32,
|
|
IOS_TOP_PORTRAIT: 64,
|
|
IOS_INSETS_TOP_PORTRAIT: 88,
|
|
STATUS_BAR_HEIGHT: 20,
|
|
PROFILE_PICTURE_SIZE: 32,
|
|
PROFILE_PICTURE_EMOJI_SIZE: 28,
|
|
DATA_SOURCE_USERS: 'users',
|
|
DATA_SOURCE_CHANNELS: 'channels',
|
|
DATA_SOURCE_DYNAMIC: 'dynamic',
|
|
NotificationLevels,
|
|
SidebarSectionTypes,
|
|
IOS_HORIZONTAL_LANDSCAPE: 44,
|
|
INDICATOR_BAR_HEIGHT,
|
|
AVATAR_LIST_PICTURE_SIZE: 24,
|
|
};
|