author int64 658 755k | date stringlengths 19 19 | timezone int64 -46,800 43.2k | hash stringlengths 40 40 | message stringlengths 5 490 | mods list | language stringclasses 20 values | license stringclasses 3 values | repo stringlengths 5 68 | original_message stringlengths 12 491 |
|---|---|---|---|---|---|---|---|---|---|
129,187 | 05.03.2021 13:01:51 | 18,000 | 48dd94ff0f6256946072dda6cf9f7177c4a5ba6a | [native] Change text in ThreadSettingsPromoteSidebar
Summary: This is just a nit... I feel like the new language is a bit clearer. "Subthread" seems confusing
Test Plan: Flow
Reviewers: atul, KatPo, palys-swm
Subscribers: zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "native/chat/settings/thread-settings-promote-sidebar.react.js",
"new_path": "native/chat/settings/thread-settings-promote-sidebar.react.js",
"diff": "@@ -61,7 +61,7 @@ class ThreadSettingsPromoteSidebar extends React.PureComponent<Props> {\niosFormat=\"highlight\"\niosHighlightUnderlayColor={panelIosHighlightUnderlay}\n>\n- <Text style={this.props.styles.text}>Promote to subthread...</Text>\n+ <Text style={this.props.styles.text}>Promote to full thread</Text>\n{loadingIndicator}\n</Button>\n</View>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Change text in ThreadSettingsPromoteSidebar
Summary: This is just a nit... I feel like the new language is a bit clearer. "Subthread" seems confusing
Test Plan: Flow
Reviewers: atul, KatPo, palys-swm
Subscribers: zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D858 |
129,187 | 05.03.2021 17:14:25 | 18,000 | 7846cae5bc809e5cc3a348cf534c682c41eb1055 | [web] Prevent setting thread titles to multi-line strings
Summary: Web equivalent of D862. These aren't used a lot, but I figured it was better to keep them updated.
Test Plan: Flow
Reviewers: atul, karol-bisztyga, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "web/modals/threads/new-thread-modal.react.js",
"new_path": "web/modals/threads/new-thread-modal.react.js",
"diff": "@@ -23,6 +23,7 @@ import {\nuseDispatchActionPromise,\nuseServerCall,\n} from 'lib/utils/action-utils';\n+import { firstLine } from 'lib/utils/string-utils';\nimport { useSelector } from '../../redux/redux-utils';\nimport css from '../../style.css';\n@@ -134,7 +135,7 @@ class NewThreadModal extends React.PureComponent<Props, State> {\n<div className={css['form-content']}>\n<input\ntype=\"text\"\n- value={this.state.name}\n+ value={firstLine(this.state.name)}\nplaceholder=\"Thread name\"\nonChange={this.onChangeName}\ndisabled={this.props.inputDisabled}\n@@ -195,7 +196,7 @@ class NewThreadModal extends React.PureComponent<Props, State> {\nonChangeName = (event: SyntheticEvent<HTMLInputElement>) => {\nconst target = event.target;\ninvariant(target instanceof HTMLInputElement, 'target not input');\n- this.setState({ name: target.value });\n+ this.setState({ name: firstLine(target.value) });\n};\nonChangeDescription = (event: SyntheticEvent<HTMLTextAreaElement>) => {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/modals/threads/thread-settings-modal.react.js",
"new_path": "web/modals/threads/thread-settings-modal.react.js",
"diff": "@@ -35,6 +35,7 @@ import {\nuseServerCall,\ntype DispatchActionPromise,\n} from 'lib/utils/action-utils';\n+import { firstLine } from 'lib/utils/string-utils';\nimport { useSelector } from '../../redux/redux-utils';\nimport css from '../../style.css';\n@@ -150,7 +151,7 @@ class ThreadSettingsModal extends React.PureComponent<Props, State> {\n<div className={css['form-content']}>\n<input\ntype=\"text\"\n- value={this.possiblyChangedValue('name')}\n+ value={firstLine(this.possiblyChangedValue('name'))}\nplaceholder={this.namePlaceholder()}\nonChange={this.onChangeName}\ndisabled={this.props.inputDisabled}\n@@ -366,7 +367,7 @@ class ThreadSettingsModal extends React.PureComponent<Props, State> {\n...prevState,\nqueuedChanges: {\n...prevState.queuedChanges,\n- name: newValue,\n+ name: firstLine(newValue),\n},\n}));\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Prevent setting thread titles to multi-line strings
Summary: Web equivalent of D862. These aren't used a lot, but I figured it was better to keep them updated.
Test Plan: Flow
Reviewers: atul, karol-bisztyga, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D863 |
129,187 | 05.03.2021 17:22:39 | 18,000 | 841a1ed761926ac857e634ad960893b87603a566 | [server] Prevent multi-line thread titles
Summary: This diff is the final in the series about multi-line thread titles. It makes sure that the server code trims all thread titles it gets to a single line.
Test Plan: Flow, careful inspection
Reviewers: atul, karol-bisztyga, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "server/src/creators/thread-creator.js",
"new_path": "server/src/creators/thread-creator.js",
"diff": "@@ -20,6 +20,7 @@ import {\n} from 'lib/types/thread-types';\nimport { ServerError } from 'lib/utils/errors';\nimport { promiseAll } from 'lib/utils/promises';\n+import { firstLine } from 'lib/utils/string-utils';\nimport { dbQuery, SQL } from '../database/database';\nimport { fetchMessageInfoByID } from '../fetchers/message-fetchers';\n@@ -218,7 +219,7 @@ async function createThread(\nconst [id] = await createIDs('threads', 1);\nconst newRoles = await createInitialRolesForNewThread(id, threadType);\n- const name = request.name ? request.name : null;\n+ const name = request.name ? firstLine(request.name) : null;\nconst description = request.description ? request.description : null;\nlet color = request.color\n? request.color.toLowerCase()\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/thread-updaters.js",
"new_path": "server/src/updaters/thread-updaters.js",
"diff": "@@ -29,6 +29,7 @@ import {\nimport { updateTypes } from 'lib/types/update-types';\nimport { ServerError } from 'lib/utils/errors';\nimport { promiseAll } from 'lib/utils/promises';\n+import { firstLine } from 'lib/utils/string-utils';\nimport createMessages from '../creators/message-creator';\nimport { createUpdates } from '../creators/update-creator';\n@@ -312,8 +313,9 @@ async function updateThread(\nconst changedFields = {};\nconst sqlUpdate = {};\n- const { name } = request.changes;\n- if (name !== undefined && name !== null) {\n+ const untrimmedName = request.changes.name;\n+ if (untrimmedName !== undefined && untrimmedName !== null) {\n+ const name = firstLine(untrimmedName);\nchangedFields.name = name;\nsqlUpdate.name = name ?? null;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Prevent multi-line thread titles
Summary: This diff is the final in the series about multi-line thread titles. It makes sure that the server code trims all thread titles it gets to a single line.
Test Plan: Flow, careful inspection
Reviewers: atul, karol-bisztyga, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D865 |
129,187 | 05.03.2021 19:33:51 | 18,000 | 3d21c5b668b3895c6859fde6053f36630a26660a | [native] codeVersion -> 80 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -133,8 +133,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 79\n- versionName \"0.0.79\"\n+ versionCode 80\n+ versionName \"0.0.80\"\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.debug.plist",
"new_path": "native/ios/SquadCal/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.79</string>\n+ <string>0.0.80</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>79</string>\n+ <string>80</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.release.plist",
"new_path": "native/ios/SquadCal/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.79</string>\n+ <string>0.0.80</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>79</string>\n+ <string>80</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux/persist.js",
"new_path": "native/redux/persist.js",
"diff": "@@ -217,7 +217,7 @@ const persistConfig = {\ntimeout: __DEV__ ? 0 : undefined,\n};\n-const codeVersion = 79;\n+const codeVersion = 80;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] codeVersion -> 80 |
129,187 | 06.03.2021 00:54:54 | 18,000 | e33030a334369793cba9a5daaf6db7af4d2a199c | [native] Revert "Use hook instead of connect in Search"
Summary: This reverts commit See discussion after land in D835
Test Plan: Make sure Calendar flow works
Reviewers: subnub, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/components/search.react.js",
"new_path": "native/components/search.react.js",
"diff": "// @flow\n+import PropTypes from 'prop-types';\nimport * as React from 'react';\n-import { View, TouchableOpacity, TextInput } from 'react-native';\n+import { View, ViewPropTypes, TouchableOpacity, TextInput } from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport { isLoggedIn } from 'lib/selectors/user-selectors';\n+import { connect } from 'lib/utils/redux-utils';\n-import { useSelector } from '../redux/redux-utils';\n-import { useStyles, useColors } from '../themes/colors';\n+import type { AppState } from '../redux/redux-setup';\n+import {\n+ type Colors,\n+ colorsPropType,\n+ colorsSelector,\n+ styleSelector,\n+} from '../themes/colors';\nimport type { ViewStyle } from '../types/styles';\ntype Props = {|\n@@ -15,33 +22,46 @@ type Props = {|\nsearchText: string,\nonChangeText: (searchText: string) => mixed,\ncontainerStyle?: ViewStyle,\n+ textInputRef?: React.Ref<typeof TextInput>,\n+ // Redux state\n+ colors: Colors,\n+ styles: typeof styles,\n+ loggedIn: boolean,\n|};\n-const Search = React.forwardRef<Props, typeof TextInput>(\n- function ForwardedSearch(props: Props, ref: React.Ref<typeof TextInput>) {\n- const { onChangeText, searchText, containerStyle, ...rest } = props;\n-\n- const clearSearch = React.useCallback(() => {\n- onChangeText('');\n- }, [onChangeText]);\n+class Search extends React.PureComponent<Props> {\n+ static propTypes = {\n+ searchText: PropTypes.string.isRequired,\n+ onChangeText: PropTypes.func.isRequired,\n+ containerStyle: ViewPropTypes.style,\n+ textInputRef: PropTypes.func,\n+ colors: colorsPropType.isRequired,\n+ styles: PropTypes.objectOf(PropTypes.object).isRequired,\n+ loggedIn: PropTypes.bool.isRequired,\n+ };\n- const loggedIn = useSelector(isLoggedIn);\n- const styles = useStyles(unboundStyles);\n- const colors = useColors();\n- const prevLoggedInRef = React.useRef();\n- React.useEffect(() => {\n- const prevLoggedIn = prevLoggedInRef.current;\n- prevLoggedInRef.current = loggedIn;\n- if (!loggedIn && prevLoggedIn) {\n- clearSearch();\n+ componentDidUpdate(prevProps: Props) {\n+ if (!this.props.loggedIn && prevProps.loggedIn) {\n+ this.clearSearch();\n+ }\n}\n- }, [loggedIn, clearSearch]);\n+ render() {\n+ const {\n+ searchText,\n+ onChangeText,\n+ containerStyle,\n+ textInputRef,\n+ colors,\n+ styles,\n+ loggedIn,\n+ ...rest\n+ } = this.props;\nconst { listSearchIcon: iconColor } = colors;\nlet clearSearchInputIcon = null;\nif (searchText) {\nclearSearchInputIcon = (\n- <TouchableOpacity onPress={clearSearch} activeOpacity={0.5}>\n+ <TouchableOpacity onPress={this.clearSearch} activeOpacity={0.5}>\n<Icon name=\"times-circle\" size={18} color={iconColor} />\n</TouchableOpacity>\n);\n@@ -56,16 +76,20 @@ const Search = React.forwardRef<Props, typeof TextInput>(\n};\nreturn (\n- <View style={[styles.search, containerStyle]}>\n+ <View style={[this.props.styles.search, containerStyle]}>\n<Icon name=\"search\" size={18} color={iconColor} />\n- <TextInput {...textInputProps} {...rest} ref={ref} />\n+ <TextInput {...textInputProps} {...rest} ref={textInputRef} />\n{clearSearchInputIcon}\n</View>\n);\n- },\n-);\n+ }\n-const unboundStyles = {\n+ clearSearch = () => {\n+ this.props.onChangeText('');\n+ };\n+}\n+\n+const styles = {\nsearch: {\nalignItems: 'center',\nbackgroundColor: 'listSearchBackground',\n@@ -85,5 +109,27 @@ const unboundStyles = {\nborderBottomColor: 'transparent',\n},\n};\n+const stylesSelector = styleSelector(styles);\n-export default Search;\n+const ConnectedSearch = connect((state: AppState) => ({\n+ colors: colorsSelector(state),\n+ styles: stylesSelector(state),\n+ loggedIn: isLoggedIn(state),\n+}))(Search);\n+\n+type ConnectedProps = $Diff<\n+ Props,\n+ {|\n+ colors: Colors,\n+ styles: typeof styles,\n+ loggedIn: boolean,\n+ |},\n+>;\n+export default React.forwardRef<ConnectedProps, typeof TextInput>(\n+ function ForwardedConnectedSearch(\n+ props: ConnectedProps,\n+ ref: React.Ref<typeof TextInput>,\n+ ) {\n+ return <ConnectedSearch {...props} textInputRef={ref} />;\n+ },\n+);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Revert "Use hook instead of connect in Search"
Summary: This reverts commit 7b538c685714bb1ca341213c52c0742b0561d65f. See discussion after land in D835
Test Plan: Make sure Calendar flow works
Reviewers: subnub, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D868 |
129,187 | 06.03.2021 02:29:06 | 18,000 | 0e2741a508d0d82bd20bd392efc2477072b6cfdd | [native] codeVersion -> 81 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -133,8 +133,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 80\n- versionName \"0.0.80\"\n+ versionCode 81\n+ versionName \"0.0.81\"\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.debug.plist",
"new_path": "native/ios/SquadCal/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.80</string>\n+ <string>0.0.81</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>80</string>\n+ <string>81</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.release.plist",
"new_path": "native/ios/SquadCal/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.80</string>\n+ <string>0.0.81</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>80</string>\n+ <string>81</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux/persist.js",
"new_path": "native/redux/persist.js",
"diff": "@@ -217,7 +217,7 @@ const persistConfig = {\ntimeout: __DEV__ ? 0 : undefined,\n};\n-const codeVersion = 80;\n+const codeVersion = 81;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] codeVersion -> 81 |
129,208 | 05.03.2021 11:43:45 | 18,000 | 8d2eef1e32853ae5bace5bdee81297d818eeeeee | [web] Use hook instead of connect in InputStateContainer
Test Plan: Checked if main content was still being rendered, and that sending text messages / multimedia still worked correctly
Reviewers: palys-swm, ashoat, atul
Subscribers: ashoat, KatPo, zrebcu411, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "web/input/input-state-container.react.js",
"new_path": "web/input/input-state-container.react.js",
"diff": "@@ -8,8 +8,8 @@ import _omit from 'lodash/fp/omit';\nimport _partition from 'lodash/fp/partition';\nimport _sortBy from 'lodash/fp/sortBy';\nimport _memoize from 'lodash/memoize';\n-import PropTypes from 'prop-types';\nimport * as React from 'react';\n+import { useDispatch } from 'react-redux';\nimport { createSelector } from 'reselect';\nimport {\n@@ -45,72 +45,59 @@ import {\nimport type { RawImagesMessageInfo } from 'lib/types/messages/images';\nimport type { RawMediaMessageInfo } from 'lib/types/messages/media';\nimport type { RawTextMessageInfo } from 'lib/types/messages/text';\n+import type { Dispatch } from 'lib/types/redux-types';\nimport { reportTypes } from 'lib/types/report-types';\n-import type {\n- DispatchActionPayload,\n- DispatchActionPromise,\n+import {\n+ type DispatchActionPromise,\n+ useServerCall,\n+ useDispatchActionPromise,\n} from 'lib/utils/action-utils';\nimport { getConfig } from 'lib/utils/config';\nimport { getMessageForException, cloneError } from 'lib/utils/errors';\n-import { connect } from 'lib/utils/redux-utils';\nimport { validateFile, preloadImage } from '../media/media-utils';\nimport InvalidUploadModal from '../modals/chat/invalid-upload.react';\n-import type { AppState } from '../redux/redux-setup';\n+import { useSelector } from '../redux/redux-utils';\nimport { type PendingMultimediaUpload, InputStateContext } from './input-state';\nlet nextLocalUploadID = 0;\n+type BaseProps = {|\n+ +children: React.Node,\n+ +setModal: (modal: ?React.Node) => void,\n+|};\ntype Props = {|\n- children: React.Node,\n- setModal: (modal: ?React.Node) => void,\n- // Redux state\n- activeChatThreadID: ?string,\n- viewerID: ?string,\n- messageStoreMessages: { [id: string]: RawMessageInfo },\n- exifRotate: boolean,\n- // Redux dispatch functions\n- dispatchActionPayload: DispatchActionPayload,\n- dispatchActionPromise: DispatchActionPromise,\n- // async functions that hit server APIs\n- uploadMultimedia: (\n+ ...BaseProps,\n+ +activeChatThreadID: ?string,\n+ +viewerID: ?string,\n+ +messageStoreMessages: { [id: string]: RawMessageInfo },\n+ +exifRotate: boolean,\n+ +dispatch: Dispatch,\n+ +dispatchActionPromise: DispatchActionPromise,\n+ +uploadMultimedia: (\nmultimedia: Object,\nextras: MultimediaUploadExtras,\ncallbacks: MultimediaUploadCallbacks,\n) => Promise<UploadMultimediaResult>,\n- deleteUpload: (id: string) => Promise<void>,\n- sendMultimediaMessage: (\n+ +deleteUpload: (id: string) => Promise<void>,\n+ +sendMultimediaMessage: (\nthreadID: string,\nlocalID: string,\nmediaIDs: $ReadOnlyArray<string>,\n) => Promise<SendMessageResult>,\n- sendTextMessage: (\n+ +sendTextMessage: (\nthreadID: string,\nlocalID: string,\ntext: string,\n) => Promise<SendMessageResult>,\n|};\ntype State = {|\n- pendingUploads: {\n+ +pendingUploads: {\n[threadID: string]: { [localUploadID: string]: PendingMultimediaUpload },\n},\n- drafts: { [threadID: string]: string },\n+ +drafts: { [threadID: string]: string },\n|};\nclass InputStateContainer extends React.PureComponent<Props, State> {\n- static propTypes = {\n- children: PropTypes.node.isRequired,\n- setModal: PropTypes.func.isRequired,\n- activeChatThreadID: PropTypes.string,\n- viewerID: PropTypes.string,\n- messageStoreMessages: PropTypes.object.isRequired,\n- exifRotate: PropTypes.bool.isRequired,\n- dispatchActionPayload: PropTypes.func.isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- uploadMultimedia: PropTypes.func.isRequired,\n- deleteUpload: PropTypes.func.isRequired,\n- sendMultimediaMessage: PropTypes.func.isRequired,\n- sendTextMessage: PropTypes.func.isRequired,\n- };\nstate: State = {\npendingUploads: {},\ndrafts: {},\n@@ -248,10 +235,10 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n}\nfor (let [, messageInfo] of newMessageInfos) {\n- this.props.dispatchActionPayload(\n- createLocalMessageActionType,\n- messageInfo,\n- );\n+ this.props.dispatch({\n+ type: createLocalMessageActionType,\n+ payload: messageInfo,\n+ });\n}\n}\n@@ -582,12 +569,15 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n`after upload`,\n);\nif (uploadAfterSuccess.messageID) {\n- this.props.dispatchActionPayload(updateMultimediaMessageMediaActionType, {\n+ this.props.dispatch({\n+ type: updateMultimediaMessageMediaActionType,\n+ payload: {\nmessageID: uploadAfterSuccess.messageID,\ncurrentMediaID: localID,\nmediaUpdate: {\nid: result.id,\n},\n+ },\n});\n}\n@@ -626,12 +616,15 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n);\nif (uploadAfterPreload.messageID) {\nconst { mediaType, uri, dimensions, loop } = result;\n- this.props.dispatchActionPayload(updateMultimediaMessageMediaActionType, {\n+ this.props.dispatch({\n+ type: updateMultimediaMessageMediaActionType,\n+ payload: {\nmessageID: uploadAfterPreload.messageID,\ncurrentMediaID: uploadAfterPreload.serverID\n? uploadAfterPreload.serverID\n: uploadAfterPreload.localID,\nmediaUpdate: { type: mediaType, uri, dimensions, loop },\n+ },\n});\n}\n@@ -745,7 +738,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nmessageLocalID,\n}),\n);\n- this.props.dispatchActionPayload(queueReportsActionType, { reports });\n+ this.props.dispatch({ type: queueReportsActionType, payload: { reports } });\n}\ncancelPendingUpload(threadID: string, localUploadID: string) {\n@@ -942,10 +935,10 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n// We're not actually starting the send here,\n// we just use this action to update the message's timestamp in Redux\n- this.props.dispatchActionPayload(\n- sendMultimediaMessageActionTypes.started,\n- newRawMessageInfo,\n- );\n+ this.props.dispatch({\n+ type: sendMultimediaMessageActionTypes.started,\n+ payload: newRawMessageInfo,\n+ });\nconst uploadIDsToRetry = new Set();\nconst uploadsToRetry = [];\n@@ -1025,17 +1018,42 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n}\n}\n-export default connect(\n- (state: AppState) => {\n+export default React.memo<BaseProps>(function ConnectedInputStateContainer(\n+ props: BaseProps,\n+) {\n+ const exifRotate = useSelector((state) => {\nconst browser = detectBrowser(state.userAgent);\n- const exifRotate =\n- !browser || (browser.name !== 'safari' && browser.name !== 'chrome');\n- return {\n- activeChatThreadID: state.navInfo.activeChatThreadID,\n- viewerID: state.currentUserInfo && state.currentUserInfo.id,\n- messageStoreMessages: state.messageStore.messages,\n- exifRotate,\n- };\n- },\n- { uploadMultimedia, deleteUpload, sendMultimediaMessage, sendTextMessage },\n-)(InputStateContainer);\n+ return !browser || (browser.name !== 'safari' && browser.name !== 'chrome');\n+ });\n+ const activeChatThreadID = useSelector(\n+ (state) => state.navInfo.activeChatThreadID,\n+ );\n+ const viewerID = useSelector(\n+ (state) => state.currentUserInfo && state.currentUserInfo.id,\n+ );\n+ const messageStoreMessages = useSelector(\n+ (state) => state.messageStore.messages,\n+ );\n+ const callUploadMultimedia = useServerCall(uploadMultimedia);\n+ const callDeleteUpload = useServerCall(deleteUpload);\n+ const callSendMultimediaMessage = useServerCall(sendMultimediaMessage);\n+ const callSendTextMessage = useServerCall(sendTextMessage);\n+ const dispatch = useDispatch();\n+ const dispatchActionPromise = useDispatchActionPromise();\n+\n+ return (\n+ <InputStateContainer\n+ {...props}\n+ activeChatThreadID={activeChatThreadID}\n+ viewerID={viewerID}\n+ messageStoreMessages={messageStoreMessages}\n+ exifRotate={exifRotate}\n+ uploadMultimedia={callUploadMultimedia}\n+ deleteUpload={callDeleteUpload}\n+ sendMultimediaMessage={callSendMultimediaMessage}\n+ sendTextMessage={callSendTextMessage}\n+ dispatch={dispatch}\n+ dispatchActionPromise={dispatchActionPromise}\n+ />\n+ );\n+});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Use hook instead of connect in InputStateContainer
Test Plan: Checked if main content was still being rendered, and that sending text messages / multimedia still worked correctly
Reviewers: palys-swm, ashoat, atul
Reviewed By: ashoat
Subscribers: ashoat, KatPo, zrebcu411, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D852 |
129,187 | 06.03.2021 13:45:04 | 18,000 | c69d12534ee0a0bbcf2968baed22a63d97cc0b0d | [native] Use hook instead of connect in Search
Summary: Re-attempt of D835 after having to revert it in D868. Will comment with the diff between this and D835
Test Plan: Make sure it's possible to create calendar events
Reviewers: subnub, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/components/search.react.js",
"new_path": "native/components/search.react.js",
"diff": "// @flow\n-import PropTypes from 'prop-types';\nimport * as React from 'react';\n-import { View, ViewPropTypes, TouchableOpacity, TextInput } from 'react-native';\n+import { View, TouchableOpacity, TextInput } from 'react-native';\nimport Icon from 'react-native-vector-icons/FontAwesome';\nimport { isLoggedIn } from 'lib/selectors/user-selectors';\n-import { connect } from 'lib/utils/redux-utils';\n-import type { AppState } from '../redux/redux-setup';\n-import {\n- type Colors,\n- colorsPropType,\n- colorsSelector,\n- styleSelector,\n-} from '../themes/colors';\n+import { useSelector } from '../redux/redux-utils';\n+import { useStyles, useColors } from '../themes/colors';\nimport type { ViewStyle } from '../types/styles';\ntype Props = {|\n...React.ElementConfig<typeof TextInput>,\n- searchText: string,\n- onChangeText: (searchText: string) => mixed,\n- containerStyle?: ViewStyle,\n- textInputRef?: React.Ref<typeof TextInput>,\n- // Redux state\n- colors: Colors,\n- styles: typeof styles,\n- loggedIn: boolean,\n+ +searchText: string,\n+ +onChangeText: (searchText: string) => mixed,\n+ +containerStyle?: ViewStyle,\n|};\n-class Search extends React.PureComponent<Props> {\n- static propTypes = {\n- searchText: PropTypes.string.isRequired,\n- onChangeText: PropTypes.func.isRequired,\n- containerStyle: ViewPropTypes.style,\n- textInputRef: PropTypes.func,\n- colors: colorsPropType.isRequired,\n- styles: PropTypes.objectOf(PropTypes.object).isRequired,\n- loggedIn: PropTypes.bool.isRequired,\n- };\n+const Search = React.forwardRef<Props, typeof TextInput>(\n+ function ForwardedSearch(props: Props, ref: React.Ref<typeof TextInput>) {\n+ const { onChangeText, searchText, containerStyle, ...rest } = props;\n- componentDidUpdate(prevProps: Props) {\n- if (!this.props.loggedIn && prevProps.loggedIn) {\n- this.clearSearch();\n- }\n+ const clearSearch = React.useCallback(() => {\n+ onChangeText('');\n+ }, [onChangeText]);\n+\n+ const loggedIn = useSelector(isLoggedIn);\n+ const styles = useStyles(unboundStyles);\n+ const colors = useColors();\n+ const prevLoggedInRef = React.useRef();\n+ React.useEffect(() => {\n+ const prevLoggedIn = prevLoggedInRef.current;\n+ prevLoggedInRef.current = loggedIn;\n+ if (!loggedIn && prevLoggedIn) {\n+ clearSearch();\n}\n+ }, [loggedIn, clearSearch]);\n- render() {\n- const {\n- searchText,\n- onChangeText,\n- containerStyle,\n- textInputRef,\n- colors,\n- styles,\n- loggedIn,\n- ...rest\n- } = this.props;\nconst { listSearchIcon: iconColor } = colors;\nlet clearSearchInputIcon = null;\nif (searchText) {\nclearSearchInputIcon = (\n- <TouchableOpacity onPress={this.clearSearch} activeOpacity={0.5}>\n+ <TouchableOpacity onPress={clearSearch} activeOpacity={0.5}>\n<Icon name=\"times-circle\" size={18} color={iconColor} />\n</TouchableOpacity>\n);\n@@ -76,20 +56,16 @@ class Search extends React.PureComponent<Props> {\n};\nreturn (\n- <View style={[this.props.styles.search, containerStyle]}>\n+ <View style={[styles.search, containerStyle]}>\n<Icon name=\"search\" size={18} color={iconColor} />\n- <TextInput {...textInputProps} {...rest} ref={textInputRef} />\n+ <TextInput {...textInputProps} {...rest} ref={ref} />\n{clearSearchInputIcon}\n</View>\n);\n- }\n-\n- clearSearch = () => {\n- this.props.onChangeText('');\n- };\n-}\n+ },\n+);\n-const styles = {\n+const unboundStyles = {\nsearch: {\nalignItems: 'center',\nbackgroundColor: 'listSearchBackground',\n@@ -109,27 +85,5 @@ const styles = {\nborderBottomColor: 'transparent',\n},\n};\n-const stylesSelector = styleSelector(styles);\n-const ConnectedSearch = connect((state: AppState) => ({\n- colors: colorsSelector(state),\n- styles: stylesSelector(state),\n- loggedIn: isLoggedIn(state),\n-}))(Search);\n-\n-type ConnectedProps = $Diff<\n- Props,\n- {|\n- colors: Colors,\n- styles: typeof styles,\n- loggedIn: boolean,\n- |},\n->;\n-export default React.forwardRef<ConnectedProps, typeof TextInput>(\n- function ForwardedConnectedSearch(\n- props: ConnectedProps,\n- ref: React.Ref<typeof TextInput>,\n- ) {\n- return <ConnectedSearch {...props} textInputRef={ref} />;\n- },\n-);\n+export default React.memo<Props>(Search);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Use hook instead of connect in Search
Summary: Re-attempt of D835 after having to revert it in D868. Will comment with the diff between this and D835
Test Plan: Make sure it's possible to create calendar events
Reviewers: subnub, palys-swm
Reviewed By: palys-swm
Subscribers: KatPo, zrebcu411, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D869 |
129,184 | 10.03.2021 00:33:48 | 28,800 | 498fb89a35e21e89a83312e7f6ed44aa15252c60 | [native] Introduce useIsAppForegrounded
Summary: Introduce useIsAppForegrounded hook. This will be changed in upcoming diffs as `foreground:boolean` is updated to `lifecycleState: LifecycleState`.
Test Plan: The updated components work as expected on iOS and android.
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/shared/lifecycle-utils.js",
"diff": "+import { useSelector } from 'react-redux';\n+\n+function useIsAppForegrounded() {\n+ return useSelector((state) => state.foreground);\n+}\n+\n+export { useIsAppForegrounded };\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/socket/calendar-query-handler.react.js",
"new_path": "lib/socket/calendar-query-handler.react.js",
"diff": "@@ -8,6 +8,7 @@ import {\nupdateCalendarQuery,\n} from '../actions/entry-actions';\nimport { timeUntilCalendarRangeExpiration } from '../selectors/nav-selectors';\n+import { useIsAppForegrounded } from '../shared/lifecycle-utils';\nimport type {\nCalendarQuery,\nCalendarQueryUpdateResult,\n@@ -127,7 +128,7 @@ export default React.memo<BaseProps>(function ConnectedCalendarQueryHandler(\n(state) => state.entryStore.lastUserInteractionCalendar,\n);\n// We include this so that componentDidUpdate will be called on foreground\n- const foreground = useSelector((state) => state.foreground);\n+ const foreground = useIsAppForegrounded();\nconst callUpdateCalendarQuery = useServerCall(updateCalendarQuery);\nconst dispatchActionPromise = useDispatchActionPromise();\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/message-store-pruner.react.js",
"new_path": "native/chat/message-store-pruner.react.js",
"diff": "@@ -4,6 +4,7 @@ import * as React from 'react';\nimport { useDispatch } from 'react-redux';\nimport { messageStorePruneActionType } from 'lib/actions/message-actions';\n+import { useIsAppForegrounded } from 'lib/shared/lifecycle-utils';\nimport { NavContext } from '../navigation/navigation-context';\nimport { useSelector } from '../redux/redux-utils';\n@@ -16,7 +17,7 @@ function MessageStorePruner() {\nconst nextMessagePruneTime = useSelector(nextMessagePruneTimeSelector);\nconst prevNextMessagePruneTimeRef = React.useRef(nextMessagePruneTime);\n- const foreground = useSelector((state) => state.foreground);\n+ const foreground = useIsAppForegrounded();\nconst frozen = useSelector((state) => state.frozen);\nconst navContext = React.useContext(NavContext);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/camera-modal.react.js",
"new_path": "native/media/camera-modal.react.js",
"diff": "@@ -30,6 +30,7 @@ import Icon from 'react-native-vector-icons/Ionicons';\nimport { useDispatch } from 'react-redux';\nimport { pathFromURI, filenameFromPathOrURI } from 'lib/media/file-utils';\n+import { useIsAppForegrounded } from 'lib/shared/lifecycle-utils';\nimport { useRealThreadCreator } from 'lib/shared/thread-utils';\nimport type { PhotoCapture } from 'lib/types/media-types';\nimport type { Dispatch } from 'lib/types/redux-types';\n@@ -1223,7 +1224,7 @@ export default React.memo<BaseProps>(function ConnectedCameraModal(\nconst dimensions = useSelector((state) => state.dimensions);\nconst deviceCameraInfo = useSelector((state) => state.deviceCameraInfo);\nconst deviceOrientation = useSelector((state) => state.deviceOrientation);\n- const foreground = useSelector((state) => state.foreground);\n+ const foreground = useIsAppForegrounded();\nconst overlayContext = React.useContext(OverlayContext);\nconst inputState = React.useContext(InputStateContext);\nconst dispatch = useDispatch();\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/media-gallery-keyboard.react.js",
"new_path": "native/media/media-gallery-keyboard.react.js",
"diff": "@@ -16,6 +16,7 @@ import { KeyboardRegistry } from 'react-native-keyboard-input';\nimport { Provider } from 'react-redux';\nimport { extensionFromFilename } from 'lib/media/file-utils';\n+import { useIsAppForegrounded } from 'lib/shared/lifecycle-utils';\nimport type { MediaLibrarySelection } from 'lib/types/media-types';\nimport type { DimensionsInfo } from '../redux/dimensions-updater.react';\n@@ -526,7 +527,7 @@ const unboundStyles = {\nfunction ConnectedMediaGalleryKeyboard() {\nconst dimensions = useSelector((state) => state.dimensions);\n- const foreground = useSelector((state) => state.foreground);\n+ const foreground = useIsAppForegrounded();\nconst colors = useColors();\nconst styles = useStyles(unboundStyles);\nreturn (\n"
},
{
"change_type": "MODIFY",
"old_path": "web/redux/visibility-handler.react.js",
"new_path": "web/redux/visibility-handler.react.js",
"diff": "@@ -7,8 +7,8 @@ import {\nbackgroundActionType,\nforegroundActionType,\n} from 'lib/reducers/foreground-reducer';\n+import { useIsAppForegrounded } from 'lib/shared/lifecycle-utils';\n-import { useSelector } from './redux-utils';\nimport { useVisibility } from './visibility';\nfunction VisibilityHandler() {\n@@ -25,7 +25,7 @@ function VisibilityHandler() {\n}, [visibility, onVisibilityChange]);\nconst dispatch = useDispatch();\n- const curForeground = useSelector((state) => state.foreground);\n+ const curForeground = useIsAppForegrounded();\nconst updateRedux = React.useCallback(\n(foreground) => {\nif (foreground === curForeground) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Introduce useIsAppForegrounded
Summary: Introduce useIsAppForegrounded hook. This will be changed in upcoming diffs as `foreground:boolean` is updated to `lifecycleState: LifecycleState`.
Test Plan: The updated components work as expected on iOS and android.
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D870 |
129,184 | 09.03.2021 13:17:18 | 28,800 | e2a42700ab5a18936f64696733db9db9d5469703 | Introduce LifecycleState type and UPDATE_LIFECYCLE_STATE action
Summary: Added LifecycleState and UPDATE_LIFECYCLE to set stage for converting `foreground:boolean` to `lifecycleState:LifecycleState`
Test Plan: Flow and things work as they did before on iOS.
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/foreground-reducer.js",
"new_path": "lib/reducers/foreground-reducer.js",
"diff": "import type { BaseAction } from '../types/redux-types';\n-export const backgroundActionType = 'BACKGROUND';\n-export const foregroundActionType = 'FOREGROUND';\nexport const unsupervisedBackgroundActionType = 'UNSUPERVISED_BACKGROUND';\n+export const updateLifecycleStateActionType = 'UPDATE_LIFECYCLE_STATE';\nexport default function reduceForeground(\nstate: boolean,\naction: BaseAction,\n): boolean {\n- if (\n- action.type === backgroundActionType ||\n- action.type === unsupervisedBackgroundActionType\n- ) {\n+ if (action.type === unsupervisedBackgroundActionType) {\nreturn false;\n- } else if (action.type === foregroundActionType) {\n+ } else if (action.type === updateLifecycleStateActionType) {\n+ if (action.payload === 'active') {\nreturn true;\n+ } else if (action.payload === 'background') {\n+ return false;\n+ }\n}\nreturn state;\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/types/lifecycle-state-types.js",
"diff": "+// @flow\n+\n+export type LifecycleState = 'active' | 'inactive' | 'background' | 'unknown';\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/redux-types.js",
"new_path": "lib/types/redux-types.js",
"diff": "@@ -28,6 +28,7 @@ import type {\nCalendarThreadFilter,\nSetCalendarDeletedFilterPayload,\n} from './filter-types';\n+import type { LifecycleState } from './lifecycle-state-types';\nimport type { LoadingStatus, LoadingInfo } from './loading-types';\nimport type { UpdateMultimediaMessageMediaPayload } from './media-types';\nimport type {\n@@ -105,693 +106,689 @@ export type AppState = NativeAppState | WebAppState;\nexport type BaseAction =\n| {|\n- type: '@@redux/INIT',\n- payload?: void,\n+ +type: '@@redux/INIT',\n+ +payload?: void,\n|}\n| {|\n- type: 'FETCH_ENTRIES_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_ENTRIES_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FETCH_ENTRIES_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_ENTRIES_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FETCH_ENTRIES_SUCCESS',\n- payload: FetchEntryInfosResult,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_ENTRIES_SUCCESS',\n+ +payload: FetchEntryInfosResult,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'LOG_OUT_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'LOG_OUT_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'LOG_OUT_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'LOG_OUT_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'LOG_OUT_SUCCESS',\n- payload: LogOutResult,\n- loadingInfo: LoadingInfo,\n+ +type: 'LOG_OUT_SUCCESS',\n+ +payload: LogOutResult,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'DELETE_ACCOUNT_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'DELETE_ACCOUNT_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'DELETE_ACCOUNT_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'DELETE_ACCOUNT_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'DELETE_ACCOUNT_SUCCESS',\n- payload: LogOutResult,\n- loadingInfo: LoadingInfo,\n+ +type: 'DELETE_ACCOUNT_SUCCESS',\n+ +payload: LogOutResult,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CREATE_LOCAL_ENTRY',\n- payload: RawEntryInfo,\n+ +type: 'CREATE_LOCAL_ENTRY',\n+ +payload: RawEntryInfo,\n|}\n| {|\n- type: 'CREATE_ENTRY_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'CREATE_ENTRY_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CREATE_ENTRY_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'CREATE_ENTRY_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CREATE_ENTRY_SUCCESS',\n- payload: CreateEntryPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'CREATE_ENTRY_SUCCESS',\n+ +payload: CreateEntryPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SAVE_ENTRY_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'SAVE_ENTRY_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SAVE_ENTRY_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'SAVE_ENTRY_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SAVE_ENTRY_SUCCESS',\n- payload: SaveEntryPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'SAVE_ENTRY_SUCCESS',\n+ +payload: SaveEntryPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CONCURRENT_MODIFICATION_RESET',\n- payload: {|\n- id: string,\n- dbText: string,\n+ +type: 'CONCURRENT_MODIFICATION_RESET',\n+ +payload: {|\n+ +id: string,\n+ +dbText: string,\n|},\n|}\n| {|\n- type: 'DELETE_ENTRY_STARTED',\n- loadingInfo: LoadingInfo,\n- payload: {|\n- localID: ?string,\n- serverID: ?string,\n+ +type: 'DELETE_ENTRY_STARTED',\n+ +loadingInfo: LoadingInfo,\n+ +payload: {|\n+ +localID: ?string,\n+ +serverID: ?string,\n|},\n|}\n| {|\n- type: 'DELETE_ENTRY_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'DELETE_ENTRY_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'DELETE_ENTRY_SUCCESS',\n- payload: ?DeleteEntryResponse,\n- loadingInfo: LoadingInfo,\n+ +type: 'DELETE_ENTRY_SUCCESS',\n+ +payload: ?DeleteEntryResponse,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'LOG_IN_STARTED',\n- loadingInfo: LoadingInfo,\n- payload: LogInStartingPayload,\n+ +type: 'LOG_IN_STARTED',\n+ +loadingInfo: LoadingInfo,\n+ +payload: LogInStartingPayload,\n|}\n| {|\n- type: 'LOG_IN_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'LOG_IN_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'LOG_IN_SUCCESS',\n- payload: LogInResult,\n- loadingInfo: LoadingInfo,\n+ +type: 'LOG_IN_SUCCESS',\n+ +payload: LogInResult,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'REGISTER_STARTED',\n- loadingInfo: LoadingInfo,\n- payload: LogInStartingPayload,\n+ +type: 'REGISTER_STARTED',\n+ +loadingInfo: LoadingInfo,\n+ +payload: LogInStartingPayload,\n|}\n| {|\n- type: 'REGISTER_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'REGISTER_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'REGISTER_SUCCESS',\n- payload: RegisterResult,\n- loadingInfo: LoadingInfo,\n+ +type: 'REGISTER_SUCCESS',\n+ +payload: RegisterResult,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'RESET_PASSWORD_STARTED',\n- payload: {| calendarQuery: CalendarQuery |},\n- loadingInfo: LoadingInfo,\n+ +type: 'RESET_PASSWORD_STARTED',\n+ +payload: {| calendarQuery: CalendarQuery |},\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'RESET_PASSWORD_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'RESET_PASSWORD_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'RESET_PASSWORD_SUCCESS',\n- payload: LogInResult,\n- loadingInfo: LoadingInfo,\n+ +type: 'RESET_PASSWORD_SUCCESS',\n+ +payload: LogInResult,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FORGOT_PASSWORD_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'FORGOT_PASSWORD_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FORGOT_PASSWORD_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'FORGOT_PASSWORD_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FORGOT_PASSWORD_SUCCESS',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'FORGOT_PASSWORD_SUCCESS',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CHANGE_USER_SETTINGS_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'CHANGE_USER_SETTINGS_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CHANGE_USER_SETTINGS_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'CHANGE_USER_SETTINGS_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CHANGE_USER_SETTINGS_SUCCESS',\n- payload: {|\n- email: string,\n+ +type: 'CHANGE_USER_SETTINGS_SUCCESS',\n+ +payload: {|\n+ +email: string,\n|},\n- loadingInfo: LoadingInfo,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'RESEND_VERIFICATION_EMAIL_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'RESEND_VERIFICATION_EMAIL_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'RESEND_VERIFICATION_EMAIL_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'RESEND_VERIFICATION_EMAIL_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'RESEND_VERIFICATION_EMAIL_SUCCESS',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'RESEND_VERIFICATION_EMAIL_SUCCESS',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CHANGE_THREAD_SETTINGS_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'CHANGE_THREAD_SETTINGS_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CHANGE_THREAD_SETTINGS_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'CHANGE_THREAD_SETTINGS_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CHANGE_THREAD_SETTINGS_SUCCESS',\n- payload: ChangeThreadSettingsPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'CHANGE_THREAD_SETTINGS_SUCCESS',\n+ +payload: ChangeThreadSettingsPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'DELETE_THREAD_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'DELETE_THREAD_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'DELETE_THREAD_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'DELETE_THREAD_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'DELETE_THREAD_SUCCESS',\n- payload: LeaveThreadPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'DELETE_THREAD_SUCCESS',\n+ +payload: LeaveThreadPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'NEW_THREAD_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'NEW_THREAD_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'NEW_THREAD_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'NEW_THREAD_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'NEW_THREAD_SUCCESS',\n- payload: NewThreadResult,\n- loadingInfo: LoadingInfo,\n+ +type: 'NEW_THREAD_SUCCESS',\n+ +payload: NewThreadResult,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'REMOVE_USERS_FROM_THREAD_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'REMOVE_USERS_FROM_THREAD_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'REMOVE_USERS_FROM_THREAD_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'REMOVE_USERS_FROM_THREAD_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'REMOVE_USERS_FROM_THREAD_SUCCESS',\n- payload: ChangeThreadSettingsPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'REMOVE_USERS_FROM_THREAD_SUCCESS',\n+ +payload: ChangeThreadSettingsPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CHANGE_THREAD_MEMBER_ROLES_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'CHANGE_THREAD_MEMBER_ROLES_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CHANGE_THREAD_MEMBER_ROLES_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'CHANGE_THREAD_MEMBER_ROLES_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'CHANGE_THREAD_MEMBER_ROLES_SUCCESS',\n- payload: ChangeThreadSettingsPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'CHANGE_THREAD_MEMBER_ROLES_SUCCESS',\n+ +payload: ChangeThreadSettingsPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FETCH_REVISIONS_FOR_ENTRY_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_REVISIONS_FOR_ENTRY_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FETCH_REVISIONS_FOR_ENTRY_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_REVISIONS_FOR_ENTRY_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FETCH_REVISIONS_FOR_ENTRY_SUCCESS',\n- payload: {|\n- entryID: string,\n- text: string,\n- deleted: boolean,\n+ +type: 'FETCH_REVISIONS_FOR_ENTRY_SUCCESS',\n+ +payload: {|\n+ +entryID: string,\n+ +text: string,\n+ +deleted: boolean,\n|},\n- loadingInfo: LoadingInfo,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'RESTORE_ENTRY_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'RESTORE_ENTRY_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'RESTORE_ENTRY_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'RESTORE_ENTRY_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'RESTORE_ENTRY_SUCCESS',\n- payload: RestoreEntryPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'RESTORE_ENTRY_SUCCESS',\n+ +payload: RestoreEntryPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'JOIN_THREAD_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'JOIN_THREAD_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'JOIN_THREAD_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'JOIN_THREAD_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'JOIN_THREAD_SUCCESS',\n- payload: ThreadJoinPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'JOIN_THREAD_SUCCESS',\n+ +payload: ThreadJoinPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'LEAVE_THREAD_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'LEAVE_THREAD_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'LEAVE_THREAD_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'LEAVE_THREAD_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'LEAVE_THREAD_SUCCESS',\n- payload: LeaveThreadPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'LEAVE_THREAD_SUCCESS',\n+ +payload: LeaveThreadPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SET_NEW_SESSION',\n- payload: SetSessionPayload,\n+ +type: 'SET_NEW_SESSION',\n+ +payload: SetSessionPayload,\n|}\n| {|\n- type: 'persist/REHYDRATE',\n- payload: ?BaseAppState<*>,\n+ +type: 'persist/REHYDRATE',\n+ +payload: ?BaseAppState<*>,\n|}\n| {|\n- type: 'FETCH_MESSAGES_BEFORE_CURSOR_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_MESSAGES_BEFORE_CURSOR_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FETCH_MESSAGES_BEFORE_CURSOR_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_MESSAGES_BEFORE_CURSOR_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FETCH_MESSAGES_BEFORE_CURSOR_SUCCESS',\n- payload: FetchMessageInfosPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_MESSAGES_BEFORE_CURSOR_SUCCESS',\n+ +payload: FetchMessageInfosPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FETCH_MOST_RECENT_MESSAGES_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_MOST_RECENT_MESSAGES_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FETCH_MOST_RECENT_MESSAGES_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_MOST_RECENT_MESSAGES_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FETCH_MOST_RECENT_MESSAGES_SUCCESS',\n- payload: FetchMessageInfosPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'FETCH_MOST_RECENT_MESSAGES_SUCCESS',\n+ +payload: FetchMessageInfosPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEND_TEXT_MESSAGE_STARTED',\n- loadingInfo: LoadingInfo,\n- payload: RawTextMessageInfo,\n+ +type: 'SEND_TEXT_MESSAGE_STARTED',\n+ +loadingInfo: LoadingInfo,\n+ +payload: RawTextMessageInfo,\n|}\n| {|\n- type: 'SEND_TEXT_MESSAGE_FAILED',\n- error: true,\n- payload: Error & {\n- localID: string,\n- threadID: string,\n+ +type: 'SEND_TEXT_MESSAGE_FAILED',\n+ +error: true,\n+ +payload: Error & {\n+ +localID: string,\n+ +threadID: string,\n},\n- loadingInfo: LoadingInfo,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEND_TEXT_MESSAGE_SUCCESS',\n- payload: SendMessagePayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'SEND_TEXT_MESSAGE_SUCCESS',\n+ +payload: SendMessagePayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEND_MULTIMEDIA_MESSAGE_STARTED',\n- loadingInfo: LoadingInfo,\n- payload: RawMultimediaMessageInfo,\n+ +type: 'SEND_MULTIMEDIA_MESSAGE_STARTED',\n+ +loadingInfo: LoadingInfo,\n+ +payload: RawMultimediaMessageInfo,\n|}\n| {|\n- type: 'SEND_MULTIMEDIA_MESSAGE_FAILED',\n- error: true,\n- payload: Error & {\n- localID: string,\n- threadID: string,\n+ +type: 'SEND_MULTIMEDIA_MESSAGE_FAILED',\n+ +error: true,\n+ +payload: Error & {\n+ +localID: string,\n+ +threadID: string,\n},\n- loadingInfo: LoadingInfo,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEND_MULTIMEDIA_MESSAGE_SUCCESS',\n- payload: SendMessagePayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'SEND_MULTIMEDIA_MESSAGE_SUCCESS',\n+ +payload: SendMessagePayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEARCH_USERS_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'SEARCH_USERS_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEARCH_USERS_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'SEARCH_USERS_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEARCH_USERS_SUCCESS',\n- payload: UserSearchResult,\n- loadingInfo: LoadingInfo,\n+ +type: 'SEARCH_USERS_SUCCESS',\n+ +payload: UserSearchResult,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SAVE_DRAFT',\n- payload: {\n- key: string,\n- draft: string,\n+ +type: 'SAVE_DRAFT',\n+ +payload: {\n+ +key: string,\n+ +draft: string,\n},\n|}\n| {|\n- type: 'UPDATE_ACTIVITY_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n- |}\n- | {|\n- type: 'UPDATE_ACTIVITY_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'UPDATE_ACTIVITY_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'UPDATE_ACTIVITY_SUCCESS',\n- payload: ActivityUpdateSuccessPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'UPDATE_ACTIVITY_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SET_DEVICE_TOKEN_STARTED',\n- payload: string,\n- loadingInfo: LoadingInfo,\n+ +type: 'UPDATE_ACTIVITY_SUCCESS',\n+ +payload: ActivityUpdateSuccessPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SET_DEVICE_TOKEN_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'SET_DEVICE_TOKEN_STARTED',\n+ +payload: string,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SET_DEVICE_TOKEN_SUCCESS',\n- payload: string,\n- loadingInfo: LoadingInfo,\n+ +type: 'SET_DEVICE_TOKEN_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'HANDLE_VERIFICATION_CODE_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'SET_DEVICE_TOKEN_SUCCESS',\n+ +payload: string,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'HANDLE_VERIFICATION_CODE_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'HANDLE_VERIFICATION_CODE_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'HANDLE_VERIFICATION_CODE_SUCCESS',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'HANDLE_VERIFICATION_CODE_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEND_REPORT_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'HANDLE_VERIFICATION_CODE_SUCCESS',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEND_REPORT_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'SEND_REPORT_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEND_REPORT_SUCCESS',\n- payload?: ClearDeliveredReportsPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'SEND_REPORT_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEND_REPORTS_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'SEND_REPORT_SUCCESS',\n+ +payload?: ClearDeliveredReportsPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEND_REPORTS_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'SEND_REPORTS_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SEND_REPORTS_SUCCESS',\n- payload?: ClearDeliveredReportsPayload,\n- loadingInfo: LoadingInfo,\n+ +type: 'SEND_REPORTS_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'QUEUE_REPORTS',\n- payload: QueueReportsPayload,\n+ +type: 'SEND_REPORTS_SUCCESS',\n+ +payload?: ClearDeliveredReportsPayload,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'SET_URL_PREFIX',\n- payload: string,\n+ +type: 'QUEUE_REPORTS',\n+ +payload: QueueReportsPayload,\n|}\n| {|\n- type: 'SAVE_MESSAGES',\n- payload: SaveMessagesPayload,\n+ +type: 'SET_URL_PREFIX',\n+ +payload: string,\n|}\n| {|\n- type: 'UPDATE_CALENDAR_THREAD_FILTER',\n- payload: CalendarThreadFilter,\n+ +type: 'SAVE_MESSAGES',\n+ +payload: SaveMessagesPayload,\n|}\n| {|\n- type: 'CLEAR_CALENDAR_THREAD_FILTER',\n- payload?: void,\n+ +type: 'UPDATE_CALENDAR_THREAD_FILTER',\n+ +payload: CalendarThreadFilter,\n|}\n| {|\n- type: 'SET_CALENDAR_DELETED_FILTER',\n- payload: SetCalendarDeletedFilterPayload,\n+ +type: 'CLEAR_CALENDAR_THREAD_FILTER',\n+ +payload?: void,\n|}\n| {|\n- type: 'UPDATE_SUBSCRIPTION_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'SET_CALENDAR_DELETED_FILTER',\n+ +payload: SetCalendarDeletedFilterPayload,\n|}\n| {|\n- type: 'UPDATE_SUBSCRIPTION_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'UPDATE_SUBSCRIPTION_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'UPDATE_SUBSCRIPTION_SUCCESS',\n- payload: SubscriptionUpdateResult,\n- loadingInfo: LoadingInfo,\n+ +type: 'UPDATE_SUBSCRIPTION_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'UPDATE_CALENDAR_QUERY_STARTED',\n- loadingInfo: LoadingInfo,\n- payload?: CalendarQueryUpdateStartingPayload,\n+ +type: 'UPDATE_SUBSCRIPTION_SUCCESS',\n+ +payload: SubscriptionUpdateResult,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'UPDATE_CALENDAR_QUERY_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'UPDATE_CALENDAR_QUERY_STARTED',\n+ +loadingInfo: LoadingInfo,\n+ +payload?: CalendarQueryUpdateStartingPayload,\n|}\n| {|\n- type: 'UPDATE_CALENDAR_QUERY_SUCCESS',\n- payload: CalendarQueryUpdateResult,\n- loadingInfo: LoadingInfo,\n+ +type: 'UPDATE_CALENDAR_QUERY_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'FULL_STATE_SYNC',\n- payload: StateSyncFullActionPayload,\n+ +type: 'UPDATE_CALENDAR_QUERY_SUCCESS',\n+ +payload: CalendarQueryUpdateResult,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'INCREMENTAL_STATE_SYNC',\n- payload: StateSyncIncrementalActionPayload,\n+ +type: 'FULL_STATE_SYNC',\n+ +payload: StateSyncFullActionPayload,\n|}\n| {|\n- type: 'PROCESS_SERVER_REQUESTS',\n- payload: ProcessServerRequestsPayload,\n+ +type: 'INCREMENTAL_STATE_SYNC',\n+ +payload: StateSyncIncrementalActionPayload,\n|}\n| {|\n- type: 'UPDATE_CONNECTION_STATUS',\n- payload: UpdateConnectionStatusPayload,\n+ +type: 'PROCESS_SERVER_REQUESTS',\n+ +payload: ProcessServerRequestsPayload,\n|}\n| {|\n- type: 'QUEUE_ACTIVITY_UPDATES',\n- payload: QueueActivityUpdatesPayload,\n+ +type: 'UPDATE_CONNECTION_STATUS',\n+ +payload: UpdateConnectionStatusPayload,\n|}\n| {|\n- type: 'FOREGROUND',\n- payload?: void,\n+ +type: 'QUEUE_ACTIVITY_UPDATES',\n+ +payload: QueueActivityUpdatesPayload,\n|}\n| {|\n- type: 'BACKGROUND',\n- payload?: void,\n+ +type: 'UNSUPERVISED_BACKGROUND',\n+ +payload?: void,\n|}\n| {|\n- type: 'UNSUPERVISED_BACKGROUND',\n- payload?: void,\n+ +type: 'UPDATE_LIFECYCLE_STATE',\n+ +payload: LifecycleState,\n|}\n| {|\n- type: 'PROCESS_UPDATES',\n- payload: UpdatesResultWithUserInfos,\n+ +type: 'PROCESS_UPDATES',\n+ +payload: UpdatesResultWithUserInfos,\n|}\n| {|\n- type: 'PROCESS_MESSAGES',\n- payload: NewMessagesPayload,\n+ +type: 'PROCESS_MESSAGES',\n+ +payload: NewMessagesPayload,\n|}\n| {|\n- type: 'MESSAGE_STORE_PRUNE',\n- payload: MessageStorePrunePayload,\n+ +type: 'MESSAGE_STORE_PRUNE',\n+ +payload: MessageStorePrunePayload,\n|}\n| {|\n- type: 'SET_LATE_RESPONSE',\n- payload: SetLateResponsePayload,\n+ +type: 'SET_LATE_RESPONSE',\n+ +payload: SetLateResponsePayload,\n|}\n| {|\n- type: 'UPDATE_DISCONNECTED_BAR',\n- payload: UpdateDisconnectedBarPayload,\n+ +type: 'UPDATE_DISCONNECTED_BAR',\n+ +payload: UpdateDisconnectedBarPayload,\n|}\n| {|\n- type: 'REQUEST_ACCESS_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'REQUEST_ACCESS_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'REQUEST_ACCESS_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'REQUEST_ACCESS_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'REQUEST_ACCESS_SUCCESS',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'REQUEST_ACCESS_SUCCESS',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'UPDATE_MULTIMEDIA_MESSAGE_MEDIA',\n- payload: UpdateMultimediaMessageMediaPayload,\n+ +type: 'UPDATE_MULTIMEDIA_MESSAGE_MEDIA',\n+ +payload: UpdateMultimediaMessageMediaPayload,\n|}\n| {|\n- type: 'CREATE_LOCAL_MESSAGE',\n- payload: LocallyComposedMessageInfo,\n+ +type: 'CREATE_LOCAL_MESSAGE',\n+ +payload: LocallyComposedMessageInfo,\n|}\n| {|\n- type: 'UPDATE_RELATIONSHIPS_STARTED',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'UPDATE_RELATIONSHIPS_STARTED',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'UPDATE_RELATIONSHIPS_FAILED',\n- error: true,\n- payload: Error,\n- loadingInfo: LoadingInfo,\n+ +type: 'UPDATE_RELATIONSHIPS_FAILED',\n+ +error: true,\n+ +payload: Error,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n- type: 'UPDATE_RELATIONSHIPS_SUCCESS',\n- payload?: void,\n- loadingInfo: LoadingInfo,\n+ +type: 'UPDATE_RELATIONSHIPS_SUCCESS',\n+ +payload?: void,\n+ +loadingInfo: LoadingInfo,\n|}\n| {|\n+type: 'SET_THREAD_UNREAD_STATUS_STARTED',\n"
},
{
"change_type": "MODIFY",
"old_path": "native/lifecycle/lifecycle-event-emitter.js",
"new_path": "native/lifecycle/lifecycle-event-emitter.js",
"diff": "@@ -5,7 +5,8 @@ import { Platform } from 'react-native';\nimport NativeEventEmitter from 'react-native/Libraries/EventEmitter/NativeEventEmitter';\nimport type { TurboModule } from 'react-native/Libraries/TurboModule/RCTExport';\nimport * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';\n-// eslint-disable-next-line import/default\n+\n+import type { LifecycleState } from 'lib/types/lifecycle-state-types';\ninterface Spec extends TurboModule {\n+getConstants: () => {|\n@@ -29,7 +30,7 @@ class LifecycleEventEmitter extends NativeEventEmitter {\n});\n}\n- addLifecycleListener = (listener: (state: ?string) => mixed) => {\n+ addLifecycleListener = (listener: (state: ?LifecycleState) => mixed) => {\nreturn this.addListener('LIFECYCLE_CHANGE', (event) => {\nlistener(event.status);\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "native/lifecycle/lifecycle-handler.react.js",
"new_path": "native/lifecycle/lifecycle-handler.react.js",
"diff": "import * as React from 'react';\nimport { useDispatch } from 'react-redux';\n-import {\n- backgroundActionType,\n- foregroundActionType,\n-} from 'lib/reducers/foreground-reducer';\n+import { updateLifecycleStateActionType } from 'lib/reducers/foreground-reducer';\n+import type { LifecycleState } from 'lib/types/lifecycle-state-types';\nimport { appBecameInactive } from '../redux/redux-setup';\nimport { addLifecycleListener } from './lifecycle';\n@@ -16,16 +14,19 @@ const LifecycleHandler = React.memo<{||}>(() => {\nconst lastStateRef = React.useRef();\nconst onLifecycleChange = React.useCallback(\n- (nextState: ?string) => {\n+ (nextState: ?LifecycleState) => {\nif (!nextState || nextState === 'unknown') {\nreturn;\n}\nconst lastState = lastStateRef.current;\nlastStateRef.current = nextState;\nif (lastState === 'background' && nextState === 'active') {\n- dispatch({ type: foregroundActionType, payload: null });\n+ dispatch({ type: updateLifecycleStateActionType, payload: 'active' });\n} else if (lastState !== 'background' && nextState === 'background') {\n- dispatch({ type: backgroundActionType, payload: null });\n+ dispatch({\n+ type: updateLifecycleStateActionType,\n+ payload: 'background',\n+ });\nappBecameInactive();\n}\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "native/lifecycle/lifecycle.js",
"new_path": "native/lifecycle/lifecycle.js",
"diff": "import { Platform, AppState as NativeAppState } from 'react-native';\n+import { type LifecycleState } from 'lib/types/lifecycle-state-types';\n+\nimport { getLifecycleEventEmitter } from './lifecycle-event-emitter';\n-function addLifecycleListener(listener: (state: ?string) => mixed) {\n+function addLifecycleListener(listener: (state: ?LifecycleState) => mixed) {\nif (Platform.OS === 'android') {\nreturn getLifecycleEventEmitter().addLifecycleListener(listener);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/redux/visibility-handler.react.js",
"new_path": "web/redux/visibility-handler.react.js",
"diff": "import * as React from 'react';\nimport { useDispatch } from 'react-redux';\n-import {\n- backgroundActionType,\n- foregroundActionType,\n-} from 'lib/reducers/foreground-reducer';\n+import { updateLifecycleStateActionType } from 'lib/reducers/foreground-reducer';\nimport { useIsAppForegrounded } from 'lib/shared/lifecycle-utils';\nimport { useVisibility } from './visibility';\n@@ -32,9 +29,12 @@ function VisibilityHandler() {\nreturn;\n}\nif (foreground) {\n- dispatch({ type: foregroundActionType, payload: null });\n+ dispatch({ type: updateLifecycleStateActionType, payload: 'active' });\n} else {\n- dispatch({ type: backgroundActionType, payload: null });\n+ dispatch({\n+ type: updateLifecycleStateActionType,\n+ payload: 'background',\n+ });\n}\n},\n[dispatch, curForeground],\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Introduce LifecycleState type and UPDATE_LIFECYCLE_STATE action
Summary: Added LifecycleState and UPDATE_LIFECYCLE to set stage for converting `foreground:boolean` to `lifecycleState:LifecycleState`
Test Plan: Flow and things work as they did before on iOS.
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D871 |
129,184 | 10.03.2021 01:37:30 | 28,800 | cb3994570ca71428a974fed2ed1535cd7dd2978f | Rename `state.foreground` to `state.lifecycleState`
Summary: Renamed `foreground` to `lifecycleState` in anticipation of converting property from boolean to LifecycleState.
Test Plan: Flow/things continue to work as expected in iOS simulator.
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/connection-reducer.js",
"new_path": "lib/reducers/connection-reducer.js",
"diff": "@@ -22,7 +22,7 @@ import {\n} from '../types/socket-types';\nimport { setNewSessionActionType } from '../utils/action-utils';\nimport { getConfig } from '../utils/config';\n-import { unsupervisedBackgroundActionType } from './foreground-reducer';\n+import { unsupervisedBackgroundActionType } from './lifecycle-state-reducer';\nexport default function reduceConnectionInfo(\nstate: ConnectionInfo,\n"
},
{
"change_type": "RENAME",
"old_path": "lib/reducers/foreground-reducer.js",
"new_path": "lib/reducers/lifecycle-state-reducer.js",
"diff": "@@ -5,7 +5,7 @@ import type { BaseAction } from '../types/redux-types';\nexport const unsupervisedBackgroundActionType = 'UNSUPERVISED_BACKGROUND';\nexport const updateLifecycleStateActionType = 'UPDATE_LIFECYCLE_STATE';\n-export default function reduceForeground(\n+export default function reduceLifecycleState(\nstate: boolean,\naction: BaseAction,\n): boolean {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/reducers/master-reducer.js",
"new_path": "lib/reducers/master-reducer.js",
"diff": "@@ -10,7 +10,7 @@ import reduceCalendarFilters from './calendar-filters-reducer';\nimport reduceConnectionInfo from './connection-reducer';\nimport reduceDataLoaded from './data-loaded-reducer';\nimport { reduceEntryInfos } from './entry-reducer';\n-import reduceForeground from './foreground-reducer';\n+import reduceLifecycleState from './lifecycle-state-reducer';\nimport { reduceLoadingStatuses } from './loading-reducer';\nimport reduceNextLocalID from './local-id-reducer';\nimport { reduceMessageStore } from './message-reducer';\n@@ -69,7 +69,7 @@ export default function baseReducer<N: BaseNavInfo, T: BaseAppState<N>>(\nurlPrefix: reduceURLPrefix(state.urlPrefix, action),\ncalendarFilters: reduceCalendarFilters(state.calendarFilters, action),\nconnection,\n- foreground: reduceForeground(state.foreground, action),\n+ lifecycleState: reduceLifecycleState(state.lifecycleState, action),\nnextLocalID: reduceNextLocalID(state.nextLocalID, action),\nqueuedReports: reduceQueuedReports(state.queuedReports, action),\ndataLoaded: reduceDataLoaded(state.dataLoaded, action),\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/socket/socket.react.js",
"new_path": "lib/socket/socket.react.js",
"diff": "@@ -10,7 +10,7 @@ import {\nsocketAuthErrorResolutionAttempt,\nlogOutActionTypes,\n} from '../actions/user-actions';\n-import { unsupervisedBackgroundActionType } from '../reducers/foreground-reducer';\n+import { unsupervisedBackgroundActionType } from '../reducers/lifecycle-state-reducer';\nimport {\npingFrequency,\nserverRequestSocketTimeout,\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/redux-types.js",
"new_path": "lib/types/redux-types.js",
"diff": "@@ -83,7 +83,7 @@ export type BaseAppState<NavInfo: BaseNavInfo> = {\nurlPrefix: string,\nconnection: ConnectionInfo,\nwatchedThreadIDs: $ReadOnlyArray<string>,\n- foreground: boolean,\n+ lifecycleState: boolean,\nnextLocalID: number,\nqueuedReports: $ReadOnlyArray<ClientReportCreationRequest>,\ndataLoaded: boolean,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/lifecycle/lifecycle-handler.react.js",
"new_path": "native/lifecycle/lifecycle-handler.react.js",
"diff": "import * as React from 'react';\nimport { useDispatch } from 'react-redux';\n-import { updateLifecycleStateActionType } from 'lib/reducers/foreground-reducer';\n+import { updateLifecycleStateActionType } from 'lib/reducers/lifecycle-state-reducer';\nimport type { LifecycleState } from 'lib/types/lifecycle-state-types';\nimport { appBecameInactive } from '../redux/redux-setup';\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux/persist.js",
"new_path": "native/redux/persist.js",
"diff": "@@ -79,7 +79,6 @@ const migrations = {\nactiveServerRequests: undefined,\nconnection: defaultConnectionInfo(Platform.OS),\nwatchedThreadIDs: [],\n- foreground: true,\nentryStore: {\n...state.entryStore,\nactualizedCalendarQuery: undefined,\n@@ -205,7 +204,7 @@ const persistConfig = {\nstorage: AsyncStorage,\nblacklist: [\n'loadingStatuses',\n- 'foreground',\n+ 'lifecycleState',\n'dimensions',\n'connectivity',\n'deviceOrientation',\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux/redux-setup.js",
"new_path": "native/redux/redux-setup.js",
"diff": "@@ -105,7 +105,7 @@ export type AppState = {|\nnotifPermissionAlertInfo: NotifPermissionAlertInfo,\nconnection: ConnectionInfo,\nwatchedThreadIDs: $ReadOnlyArray<string>,\n- foreground: boolean,\n+ lifecycleState: boolean,\nnextLocalID: number,\nqueuedReports: $ReadOnlyArray<ClientReportCreationRequest>,\n_persist: ?PersistState,\n@@ -154,7 +154,7 @@ const defaultState = ({\nnotifPermissionAlertInfo: defaultNotifPermissionAlertInfo,\nconnection: defaultConnectionInfo(Platform.OS),\nwatchedThreadIDs: [],\n- foreground: true,\n+ lifecycleState: true,\nnextLocalID: 0,\nqueuedReports: [],\n_persist: null,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/socket.react.js",
"new_path": "native/socket.react.js",
"diff": "@@ -36,7 +36,9 @@ export default React.memo<BaseSocketProps>(function NativeSocket(\nconst urlPrefix = useSelector((state) => state.urlPrefix);\nconst connection = useSelector((state) => state.connection);\nconst frozen = useSelector((state) => state.frozen);\n- const active = useSelector((state) => isLoggedIn(state) && state.foreground);\n+ const active = useSelector(\n+ (state) => isLoggedIn(state) && state.lifecycleState,\n+ );\nconst openSocket = useSelector(openSocketSelector);\nconst sessionIdentification = useSelector(sessionIdentificationSelector);\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/website-responders.js",
"new_path": "server/src/responders/website-responders.js",
"diff": "@@ -256,7 +256,7 @@ async function websiteResponder(\nactualizedCalendarQuery: calendarQuery,\n},\nwatchedThreadIDs: [],\n- foreground: true,\n+ lifecycleState: true,\nnextLocalID: 0,\nqueuedReports: [],\ntimeZone: viewer.timeZone,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/redux/redux-setup.js",
"new_path": "web/redux/redux-setup.js",
"diff": "@@ -68,7 +68,7 @@ export type AppState = {|\nbaseHref: string,\nconnection: ConnectionInfo,\nwatchedThreadIDs: $ReadOnlyArray<string>,\n- foreground: boolean,\n+ lifecycleState: boolean,\nnextLocalID: number,\nqueuedReports: $ReadOnlyArray<ClientReportCreationRequest>,\ntimeZone: ?string,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/redux/visibility-handler.react.js",
"new_path": "web/redux/visibility-handler.react.js",
"diff": "import * as React from 'react';\nimport { useDispatch } from 'react-redux';\n-import { updateLifecycleStateActionType } from 'lib/reducers/foreground-reducer';\n+import { updateLifecycleStateActionType } from 'lib/reducers/lifecycle-state-reducer';\nimport { useIsAppForegrounded } from 'lib/shared/lifecycle-utils';\nimport { useVisibility } from './visibility';\n"
},
{
"change_type": "MODIFY",
"old_path": "web/socket.react.js",
"new_path": "web/socket.react.js",
"diff": "@@ -33,7 +33,7 @@ export default React.memo<BaseSocketProps>(function WebSocket(\n(state) =>\n!!state.currentUserInfo &&\n!state.currentUserInfo.anonymous &&\n- state.foreground,\n+ state.lifecycleState,\n);\nconst openSocket = useSelector(openSocketSelector);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Rename `state.foreground` to `state.lifecycleState`
Summary: Renamed `foreground` to `lifecycleState` in anticipation of converting property from boolean to LifecycleState.
Test Plan: Flow/things continue to work as expected in iOS simulator.
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D872 |
129,184 | 10.03.2021 11:45:37 | 28,800 | 1c6e6a3a61f7ddaa7e9ba76425273e704033d7c9 | [lib] Introduce useIsAppBackgroundedOrInactive
Summary: Created `useIsAppBackgroundedOrInactive` hook
Test Plan: Tested with VideoPlaybackModal (next diff) and hook works as expected.
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/lifecycle-utils.js",
"new_path": "lib/shared/lifecycle-utils.js",
"diff": "import { useSelector } from 'react-redux';\n+// Note: This hook mimics the prior state.foreground property\n+// and considers `inactive` on iOS as equivalent to `active`\nfunction useIsAppForegrounded() {\nreturn useSelector((state) => state.lifecycleState !== 'background');\n}\n-export { useIsAppForegrounded };\n+function useIsAppBackgroundedOrInactive() {\n+ return useSelector((state) => state.lifecycleState !== 'active');\n+}\n+\n+export { useIsAppForegrounded, useIsAppBackgroundedOrInactive };\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Introduce useIsAppBackgroundedOrInactive
Summary: Created `useIsAppBackgroundedOrInactive` hook
Test Plan: Tested with VideoPlaybackModal (next diff) and hook works as expected.
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D880 |
129,184 | 10.03.2021 11:50:04 | 28,800 | 9aa33aeeefe93f265b55bf64a765cff0635e65e4 | [native] Pause video playback when app is backgrounded/inactive
Summary: Pause video playback when app is backgrounded or inactive based on `state.lifecycleState`
Test Plan: `VideoPlaybackModal` changed `paused` state as expected when switching apps, going to homescreen, opening control center, etc.
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "native/media/video-playback-modal.react.js",
"new_path": "native/media/video-playback-modal.react.js",
"diff": "@@ -9,6 +9,7 @@ import Animated from 'react-native-reanimated';\nimport Icon from 'react-native-vector-icons/MaterialCommunityIcons';\nimport Video from 'react-native-video';\n+import { useIsAppBackgroundedOrInactive } from 'lib/shared/lifecycle-utils';\nimport type { MediaInfo } from 'lib/types/media-types';\nimport type { ChatMultimediaMessageInfoItem } from '../chat/multimedia-message.react';\n@@ -218,6 +219,13 @@ function VideoPlaybackModal(props: Props) {\nconst [totalDuration, setTotalDuration] = useState('0:00');\nconst videoRef = React.useRef();\n+ const backgroundedOrInactive = useIsAppBackgroundedOrInactive();\n+ React.useEffect(() => {\n+ if (backgroundedOrInactive) {\n+ setPaused(true);\n+ }\n+ }, [backgroundedOrInactive]);\n+\nconst {\nnavigation,\nroute: {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Pause video playback when app is backgrounded/inactive
Summary: Pause video playback when app is backgrounded or inactive based on `state.lifecycleState`
Test Plan: `VideoPlaybackModal` changed `paused` state as expected when switching apps, going to homescreen, opening control center, etc.
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D881 |
129,191 | 09.03.2021 16:28:03 | -3,600 | c643fa0ff5e8d944014111d5eda0c19ee47ac724 | [lib] Limit username input length
Test Plan: Try to create accounts with username length: 5, 6, 191, 192 characters - 5 and 192 should fail, other succeed.
Reviewers: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/account-utils.js",
"new_path": "lib/shared/account-utils.js",
"diff": "@@ -9,9 +9,15 @@ import type { AppState } from '../types/redux-types';\nimport type { PreRequestUserState } from '../types/session-types';\nimport type { CurrentUserInfo } from '../types/user-types';\n+const usernameMaxLength = 191;\n+const validUsernameRegexString = `^[a-zA-Z0-9][a-zA-Z0-9-_]{5,${\n+ usernameMaxLength - 1\n+}}$`;\n+const validUsernameRegex = new RegExp(validUsernameRegexString);\n+\nconst oldValidUsernameRegexString = '[a-zA-Z0-9-_]+';\n-const validUsernameRegex = /^[a-zA-Z0-9][a-zA-Z0-9-_]{5,}$/;\nconst oldValidUsernameRegex = new RegExp(`^${oldValidUsernameRegexString}$`);\n+\nconst validEmailRegex = new RegExp(\n/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+/.source +\n/@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?/.source +\n@@ -63,6 +69,7 @@ function invalidSessionRecovery(\n}\nexport {\n+ usernameMaxLength,\noldValidUsernameRegexString,\nvalidUsernameRegex,\noldValidUsernameRegex,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/scripts/create-db.js",
"new_path": "server/src/scripts/create-db.js",
"diff": "@@ -6,6 +6,7 @@ import {\nmakePermissionsBlob,\nmakePermissionsForChildrenBlob,\n} from 'lib/permissions/thread-permissions';\n+import { usernameMaxLength } from 'lib/shared/account-utils';\nimport { sortIDs } from 'lib/shared/relationship-utils';\nimport { undirectedStatus } from 'lib/types/relationship-types';\nimport { threadTypes } from 'lib/types/thread-types';\n@@ -184,7 +185,7 @@ async function createTables() {\nCREATE TABLE users (\nid bigint(20) NOT NULL,\n- username varchar(191) COLLATE utf8mb4_bin NOT NULL,\n+ username varchar(${usernameMaxLength}) COLLATE utf8mb4_bin NOT NULL,\nhash char(60) COLLATE utf8mb4_bin NOT NULL,\nemail varchar(191) COLLATE utf8mb4_bin NOT NULL,\nemail_verified tinyint(1) UNSIGNED NOT NULL DEFAULT '0',\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Limit username input length
Test Plan: Try to create accounts with username length: 5, 6, 191, 192 characters - 5 and 192 should fail, other succeed.
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D876 |
129,191 | 11.03.2021 15:31:08 | -3,600 | 1ef53ff7ebbc505ac66a15491c4cd94d614c9a89 | [web] Correctly display longer usernames in edit account modal
Test Plan: Log in as a user with long username, open edit account modal and check if username was displayed correctly.
Reviewers: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "web/style.css",
"new_path": "web/style.css",
"diff": "@@ -451,12 +451,18 @@ div.modal-body div.form-footer div.modal-form-error ol {\npadding-left: 20px;\n}\n+div.form-text {\n+ display: flex;\n+ align-items: baseline;\n+}\ndiv.form-text > div.form-title {\nvertical-align: initial;\n+ flex-shrink: 0;\n}\ndiv.form-text > div.form-content {\nmargin-left: 3px;\nmargin-bottom: 3px;\n+ word-break: break-word;\n}\ndiv.form-text > div.form-float-title {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Correctly display longer usernames in edit account modal
Test Plan: Log in as a user with long username, open edit account modal and check if username was displayed correctly.
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D888 |
129,187 | 12.03.2021 16:45:59 | 18,000 | 588853e46b4cfa075347fb2b7fcd9e23f19de972 | [web] Fix Safari layout after D893
Summary: I accidentally broke Safari in D893. This diff fixes it, and makes sure Chrome and Firefox are still fixed too.
Test Plan: Test scrolling up in chat view in Safari, Chrome, Firefox
Reviewers: atul, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "web/style.css",
"new_path": "web/style.css",
"diff": "@@ -49,7 +49,6 @@ input[type='submit']::-moz-focus-inner {\n}\nheader.header {\n- flex: 0 1 auto;\nbackground-image: url(../images/background.png);\nbackground-size: 3000px 2000px;\nbackground-attachment: fixed;\n@@ -117,7 +116,6 @@ div.chatBadge {\n}\ndiv.main-content-container {\n- flex: 1 0 0;\nposition: relative;\nheight: calc(100% - 62px);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Fix Safari layout after D893
Summary: I accidentally broke Safari in D893. This diff fixes it, and makes sure Chrome and Firefox are still fixed too.
Test Plan: Test scrolling up in chat view in Safari, Chrome, Firefox
Reviewers: atul, palys-swm
Reviewed By: atul
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D898 |
129,187 | 12.03.2021 15:38:31 | 18,000 | 65c7fe8d101ed5f4f49e1c6252e64ad6c12312f3 | [lib] Kill connect function and associated utilities
Test Plan: Flow
Reviewers: subnub, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "lib/utils/action-utils.js",
"new_path": "lib/utils/action-utils.js",
"diff": "// @flow\n-import invariant from 'invariant';\n-import _mapValues from 'lodash/fp/mapValues';\nimport _memoize from 'lodash/memoize';\nimport * as React from 'react';\nimport { useSelector, useDispatch } from 'react-redux';\n@@ -93,10 +91,6 @@ function wrapActionPromise<\n};\n}\n-export type DispatchActionPayload = <T: string, P: ActionPayload>(\n- actionType: T,\n- payload: P,\n-) => void;\nexport type DispatchActionPromise = <\nA: BaseAction,\nB: BaseAction,\n@@ -144,25 +138,6 @@ export type DispatchFunctions = {|\n+dispatchActionPromise: DispatchActionPromise,\n|};\n-type LegacyDispatchFunctions = {\n- dispatch: Dispatch,\n- dispatchActionPayload: DispatchActionPayload,\n- dispatchActionPromise: DispatchActionPromise,\n-};\n-function includeDispatchActionProps(\n- dispatch: Dispatch,\n-): LegacyDispatchFunctions {\n- const dispatchActionPromise = createDispatchActionPromise(dispatch);\n- const dispatchActionPayload = function <T: string, P: ActionPayload>(\n- actionType: T,\n- payload: P,\n- ) {\n- const action = { type: actionType, payload };\n- dispatch(action);\n- };\n- return { dispatch, dispatchActionPayload, dispatchActionPromise };\n-}\n-\nlet currentlyWaitingForNewCookie = false;\nlet fetchJSONCallsWaitingForNewCookie: ((fetchJSON: ?FetchJSON) => void)[] = [];\n@@ -422,55 +397,11 @@ const createBoundServerCallsSelector: (\nbaseCreateBoundServerCallsSelector,\n);\n-export type ServerCalls = { [name: string]: ActionFunc };\nexport type BoundServerCall = (...rest: $FlowFixMe) => Promise<any>;\n-function bindServerCalls(serverCalls: ServerCalls) {\n- return (\n- stateProps: {\n- cookie: ?string,\n- urlPrefix: string,\n- sessionID: ?string,\n- currentUserInfo: ?CurrentUserInfo,\n- connectionStatus: ConnectionStatus,\n- },\n- dispatchProps: Object,\n- ownProps: { [propName: string]: mixed },\n- ) => {\n- const dispatch = dispatchProps.dispatch;\n- invariant(dispatch, 'should be defined');\n- const {\n- cookie,\n- urlPrefix,\n- sessionID,\n- currentUserInfo,\n- connectionStatus,\n- } = stateProps;\n- const boundServerCalls = _mapValues(\n- (serverCall: (fetchJSON: FetchJSON, ...rest: any) => Promise<any>) =>\n- createBoundServerCallsSelector(serverCall)({\n- dispatch,\n- cookie,\n- urlPrefix,\n- sessionID,\n- currentUserInfo,\n- connectionStatus,\n- }),\n- )(serverCalls);\n- return {\n- ...ownProps,\n- ...stateProps,\n- ...dispatchProps,\n- ...boundServerCalls,\n- };\n- };\n-}\n-\nfunction useServerCall(serverCall: ActionFunc): BoundServerCall {\nconst dispatch = useDispatch();\n- const serverCallState = useSelector((state) =>\n- serverCallStateSelector(state),\n- );\n+ const serverCallState = useSelector(serverCallStateSelector);\nreturn React.useMemo(\n() =>\ncreateBoundServerCallsSelector(serverCall)({\n@@ -489,10 +420,8 @@ function registerActiveSocket(passedSocketAPIHandler: ?SocketAPIHandler) {\nexport {\nuseDispatchActionPromise,\nsetNewSessionActionType,\n- includeDispatchActionProps,\nfetchNewCookieFromNativeCredentials,\ncreateBoundServerCallsSelector,\n- bindServerCalls,\nregisterActiveSocket,\nuseServerCall,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/utils/redux-utils.js",
"new_path": "lib/utils/redux-utils.js",
"diff": "// @flow\n-import invariant from 'invariant';\n-import {\n- connect as reactReduxConnect,\n- useSelector as reactReduxUseSelector,\n-} from 'react-redux';\n+import { useSelector as reactReduxUseSelector } from 'react-redux';\n-import { serverCallStateSelector } from '../selectors/server-calls';\nimport type { AppState } from '../types/redux-types';\n-import type { ConnectionStatus } from '../types/socket-types';\n-import type { CurrentUserInfo } from '../types/user-types';\n-import type { ServerCalls } from './action-utils';\n-import { includeDispatchActionProps, bindServerCalls } from './action-utils';\n-\n-function connect<S: AppState, OP: Object, SP: Object>(\n- inputMapStateToProps: ?(state: S, ownProps: OP) => SP,\n- serverCalls?: ?ServerCalls,\n- includeDispatch?: boolean,\n-): * {\n- const mapStateToProps = inputMapStateToProps;\n- const serverCallExists = serverCalls && Object.keys(serverCalls).length > 0;\n- let mapState = null;\n- if (serverCallExists && mapStateToProps && mapStateToProps.length > 1) {\n- mapState = (\n- state: S,\n- ownProps: OP,\n- ): {\n- ...SP,\n- cookie: ?string,\n- urlPrefix: string,\n- sessionID: ?string,\n- currentUserInfo: ?CurrentUserInfo,\n- connectionStatus: ConnectionStatus,\n- } => ({\n- ...mapStateToProps(state, ownProps),\n- ...serverCallStateSelector(state),\n- });\n- } else if (serverCallExists && mapStateToProps) {\n- mapState = (\n- state: S,\n- ): {\n- ...SP,\n- cookie: ?string,\n- urlPrefix: string,\n- sessionID: ?string,\n- currentUserInfo: ?CurrentUserInfo,\n- connectionStatus: ConnectionStatus,\n- } => ({\n- // $FlowFixMe\n- ...mapStateToProps(state),\n- ...serverCallStateSelector(state),\n- });\n- } else if (mapStateToProps) {\n- mapState = mapStateToProps;\n- } else if (serverCallExists) {\n- mapState = serverCallStateSelector;\n- }\n- const dispatchIncluded =\n- includeDispatch === true ||\n- (includeDispatch === undefined && serverCallExists);\n- if (dispatchIncluded && serverCallExists) {\n- invariant(mapState && serverCalls, 'should be set');\n- return reactReduxConnect(\n- mapState,\n- includeDispatchActionProps,\n- bindServerCalls(serverCalls),\n- );\n- } else if (dispatchIncluded) {\n- return reactReduxConnect(mapState, includeDispatchActionProps);\n- } else if (serverCallExists) {\n- invariant(mapState && serverCalls, 'should be set');\n- return reactReduxConnect(mapState, undefined, bindServerCalls(serverCalls));\n- } else {\n- invariant(mapState, 'should be set');\n- return reactReduxConnect(mapState);\n- }\n-}\nfunction useSelector<SS>(\nselector: (state: AppState) => SS,\n@@ -84,4 +11,4 @@ function useSelector<SS>(\nreturn reactReduxUseSelector(selector, equalityFn);\n}\n-export { connect, useSelector };\n+export { useSelector };\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Kill connect function and associated utilities
Test Plan: Flow
Reviewers: subnub, palys-swm
Reviewed By: palys-swm
Subscribers: KatPo, zrebcu411, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D895 |
129,184 | 14.03.2021 23:26:01 | 25,200 | e84d6e0468f68085c699861695f7d25b4528176c | [web] [lib] Remove mediaMissionStepPropType
Summary: NA
Test Plan: flow
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/types/media-types.js",
"new_path": "lib/types/media-types.js",
"diff": "// @flow\n-import PropTypes from 'prop-types';\n-\nimport type { Shape } from './core';\n-import { type Platform, platformPropType } from './device-types';\n+import { type Platform } from './device-types';\nexport type Dimensions = $ReadOnly<{|\nheight: number,\nwidth: number,\n|}>;\n-export const dimensionsPropType = PropTypes.shape({\n- height: PropTypes.number.isRequired,\n- width: PropTypes.number.isRequired,\n-});\n-\nexport type MediaType = 'photo' | 'video';\nexport type Image = {|\n@@ -57,25 +50,6 @@ export type MediaInfo =\nindex: number,\n|};\n-export const cornersPropType = PropTypes.shape({\n- topLeft: PropTypes.bool,\n- topRight: PropTypes.bool,\n- bottomLeft: PropTypes.bool,\n- bottomRight: PropTypes.bool,\n-});\n-\n-export const mediaTypePropType = PropTypes.oneOf(['photo', 'video']);\n-\n-export const mediaInfoPropType = PropTypes.shape({\n- id: PropTypes.string.isRequired,\n- uri: PropTypes.string.isRequired,\n- type: mediaTypePropType.isRequired,\n- dimensions: dimensionsPropType.isRequired,\n- filename: PropTypes.string,\n- corners: cornersPropType.isRequired,\n- index: PropTypes.number.isRequired,\n-});\n-\nexport type UploadMultimediaResult = {|\nid: string,\nuri: string,\n@@ -224,34 +198,6 @@ export type MediaLibrarySelection =\nduration: number, // seconds\n|};\n-const photoLibrarySelectionPropType = PropTypes.shape({\n- step: PropTypes.oneOf(['photo_library']).isRequired,\n- dimensions: dimensionsPropType.isRequired,\n- filename: PropTypes.string.isRequired,\n- uri: PropTypes.string.isRequired,\n- mediaNativeID: PropTypes.string.isRequired,\n- selectTime: PropTypes.number.isRequired,\n- sendTime: PropTypes.number.isRequired,\n- retries: PropTypes.number.isRequired,\n-});\n-\n-const videoLibrarySelectionPropType = PropTypes.shape({\n- step: PropTypes.oneOf(['video_library']).isRequired,\n- dimensions: dimensionsPropType.isRequired,\n- filename: PropTypes.string.isRequired,\n- uri: PropTypes.string.isRequired,\n- mediaNativeID: PropTypes.string.isRequired,\n- selectTime: PropTypes.number.isRequired,\n- sendTime: PropTypes.number.isRequired,\n- retries: PropTypes.number.isRequired,\n- duration: PropTypes.number.isRequired,\n-});\n-\n-export const mediaLibrarySelectionPropType = PropTypes.oneOfType([\n- photoLibrarySelectionPropType,\n- videoLibrarySelectionPropType,\n-]);\n-\nexport type PhotoCapture = {|\nstep: 'photo_capture',\ntime: number, // ms\n@@ -274,16 +220,6 @@ export type PhotoPaste = {|\n+retries: number,\n|};\n-const photoPasteSelectionPropType = PropTypes.exact({\n- step: PropTypes.oneOf(['photo_paste']).isRequired,\n- dimensions: dimensionsPropType.isRequired,\n- filename: PropTypes.string.isRequired,\n- uri: PropTypes.string.isRequired,\n- selectTime: PropTypes.number.isRequired,\n- sendTime: PropTypes.number.isRequired,\n- retries: PropTypes.number.isRequired,\n-});\n-\nexport type NativeMediaSelection =\n| MediaLibrarySelection\n| PhotoCapture\n@@ -558,361 +494,3 @@ export type MediaMission = {|\nuserTime: number,\ntotalTime: number,\n|};\n-\n-export const mediaMissionStepPropType = PropTypes.oneOfType([\n- photoLibrarySelectionPropType,\n- videoLibrarySelectionPropType,\n- photoPasteSelectionPropType,\n- PropTypes.shape({\n- step: PropTypes.oneOf(['photo_capture']).isRequired,\n- time: PropTypes.number.isRequired,\n- dimensions: dimensionsPropType.isRequired,\n- filename: PropTypes.string.isRequired,\n- uri: PropTypes.string.isRequired,\n- captureTime: PropTypes.number.isRequired,\n- selectTime: PropTypes.number.isRequired,\n- sendTime: PropTypes.number.isRequired,\n- retries: PropTypes.number.isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['web_selection']).isRequired,\n- filename: PropTypes.string.isRequired,\n- size: PropTypes.number.isRequired,\n- mime: PropTypes.string.isRequired,\n- selectTime: PropTypes.number.isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['asset_info_fetch']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- localURI: PropTypes.string,\n- orientation: PropTypes.number,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['stat_file']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- uri: PropTypes.string.isRequired,\n- fileSize: PropTypes.number,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['read_file_header']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- uri: PropTypes.string.isRequired,\n- mime: PropTypes.string,\n- mediaType: mediaTypePropType,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['determine_file_type']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- inputFilename: PropTypes.string.isRequired,\n- outputMIME: PropTypes.string,\n- outputMediaType: mediaTypePropType,\n- outputFilename: PropTypes.string,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['frame_count']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- path: PropTypes.string.isRequired,\n- mime: PropTypes.string.isRequired,\n- hasMultipleFrames: PropTypes.bool,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['photo_manipulation']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- manipulation: PropTypes.object.isRequired,\n- newMIME: PropTypes.string,\n- newDimensions: dimensionsPropType,\n- newURI: PropTypes.string,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['video_probe']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- path: PropTypes.string.isRequired,\n- validFormat: PropTypes.bool.isRequired,\n- duration: PropTypes.number,\n- codec: PropTypes.string,\n- format: PropTypes.arrayOf(PropTypes.string),\n- dimensions: dimensionsPropType,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['video_ffmpeg_transcode']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- returnCode: PropTypes.number,\n- newPath: PropTypes.string,\n- stats: PropTypes.object,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['dispose_temporary_file']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- path: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['save_media']).isRequired,\n- uri: PropTypes.string.isRequired,\n- time: PropTypes.number.isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['permissions_check']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- platform: platformPropType.isRequired,\n- permissions: PropTypes.arrayOf(PropTypes.string).isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['make_directory']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- path: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['android_scan_file']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- path: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['fetch_file_hash']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- path: PropTypes.string.isRequired,\n- hash: PropTypes.string,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['copy_file']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- source: PropTypes.string.isRequired,\n- destination: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['ios_save_to_library']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- uri: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['fetch_blob']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- inputURI: PropTypes.string.isRequired,\n- uri: PropTypes.string.isRequired,\n- size: PropTypes.number,\n- mime: PropTypes.string,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['data_uri_from_blob']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- first255Chars: PropTypes.string,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['array_buffer_from_blob']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['mime_check']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- mime: PropTypes.string,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['write_file']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- path: PropTypes.string.isRequired,\n- length: PropTypes.number.isRequired,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['exif_fetch']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- orientation: PropTypes.number,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['preload_image']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- uri: PropTypes.string.isRequired,\n- dimensions: dimensionsPropType,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['reorient_image']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- uri: PropTypes.string,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['upload']).isRequired,\n- success: PropTypes.bool.isRequired,\n- exceptionMessage: PropTypes.string,\n- time: PropTypes.number.isRequired,\n- inputFilename: PropTypes.string.isRequired,\n- outputMediaType: mediaTypePropType,\n- outputURI: PropTypes.string,\n- outputDimensions: dimensionsPropType,\n- outputLoop: PropTypes.bool,\n- hasWiFi: PropTypes.bool,\n- }),\n- PropTypes.shape({\n- step: PropTypes.oneOf(['wait_for_capture_uri_unload']).isRequired,\n- success: PropTypes.bool.isRequired,\n- time: PropTypes.number.isRequired,\n- uri: PropTypes.string.isRequired,\n- }),\n-]);\n-\n-export const mediaMissionPropType = PropTypes.shape({\n- steps: PropTypes.arrayOf(mediaMissionStepPropType).isRequired,\n- result: PropTypes.oneOfType([\n- PropTypes.shape({\n- success: PropTypes.oneOf([true]).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['no_file_path']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['file_stat_failed']).isRequired,\n- uri: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['photo_manipulation_failed']).isRequired,\n- size: PropTypes.number.isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['media_type_fetch_failed']).isRequired,\n- detectedMIME: PropTypes.string,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['mime_type_mismatch']).isRequired,\n- reportedMediaType: mediaTypePropType.isRequired,\n- reportedMIME: PropTypes.string.isRequired,\n- detectedMIME: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['http_upload_failed']).isRequired,\n- exceptionMessage: PropTypes.string,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['video_too_long']).isRequired,\n- duration: PropTypes.number.isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['video_probe_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['video_transcode_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['processing_exception']).isRequired,\n- time: PropTypes.number.isRequired,\n- exceptionMessage: PropTypes.string,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['save_unsupported']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['missing_permission']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['make_directory_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['resolve_failed']).isRequired,\n- uri: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['save_to_library_failed']).isRequired,\n- uri: PropTypes.string.isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['fetch_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['data_uri_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['array_buffer_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['mime_check_failed']).isRequired,\n- mime: PropTypes.string,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['write_file_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['fetch_file_hash_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['copy_file_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['exif_fetch_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['reorient_image_failed']).isRequired,\n- }),\n- PropTypes.shape({\n- success: PropTypes.oneOf([false]).isRequired,\n- reason: PropTypes.oneOf(['web_sibling_validation_failed']).isRequired,\n- }),\n- ]),\n- userTime: PropTypes.number.isRequired,\n- totalTime: PropTypes.number.isRequired,\n-});\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/report-types.js",
"new_path": "lib/types/report-types.js",
"diff": "// @flow\nimport invariant from 'invariant';\n-import PropTypes from 'prop-types';\n-\n-import { type PlatformDetails, platformDetailsPropType } from './device-types';\n-import {\n- type RawEntryInfo,\n- type CalendarQuery,\n- rawEntryInfoPropType,\n- calendarQueryPropType,\n-} from './entry-types';\n-import { type MediaMission, mediaMissionPropType } from './media-types';\n+\n+import { type PlatformDetails } from './device-types';\n+import { type RawEntryInfo, type CalendarQuery } from './entry-types';\n+import { type MediaMission } from './media-types';\nimport type { AppState, BaseAction } from './redux-types';\n-import { type RawThreadInfo, rawThreadInfoPropType } from './thread-types';\n+import { type RawThreadInfo } from './thread-types';\nimport type { UserInfo, UserInfos } from './user-types';\nexport const reportTypes = Object.freeze({\n@@ -158,55 +152,6 @@ export type ClearDeliveredReportsPayload = {|\nreports: $ReadOnlyArray<ClientReportCreationRequest>,\n|};\n-const actionSummaryPropType = PropTypes.shape({\n- type: PropTypes.string.isRequired,\n- time: PropTypes.number.isRequired,\n- summary: PropTypes.string.isRequired,\n-});\n-export const queuedClientReportCreationRequestPropType = PropTypes.oneOfType([\n- PropTypes.shape({\n- type: PropTypes.oneOf([reportTypes.THREAD_INCONSISTENCY]).isRequired,\n- platformDetails: platformDetailsPropType.isRequired,\n- beforeAction: PropTypes.objectOf(rawThreadInfoPropType).isRequired,\n- action: PropTypes.object.isRequired,\n- pollResult: PropTypes.objectOf(rawThreadInfoPropType),\n- pushResult: PropTypes.objectOf(rawThreadInfoPropType).isRequired,\n- lastActions: PropTypes.arrayOf(actionSummaryPropType).isRequired,\n- time: PropTypes.number.isRequired,\n- }),\n- PropTypes.shape({\n- type: PropTypes.oneOf([reportTypes.ENTRY_INCONSISTENCY]).isRequired,\n- platformDetails: platformDetailsPropType.isRequired,\n- beforeAction: PropTypes.objectOf(rawEntryInfoPropType).isRequired,\n- action: PropTypes.object.isRequired,\n- calendarQuery: calendarQueryPropType.isRequired,\n- pollResult: PropTypes.objectOf(rawEntryInfoPropType),\n- pushResult: PropTypes.objectOf(rawEntryInfoPropType).isRequired,\n- lastActions: PropTypes.arrayOf(actionSummaryPropType).isRequired,\n- time: PropTypes.number.isRequired,\n- }),\n- PropTypes.shape({\n- type: PropTypes.oneOf([reportTypes.MEDIA_MISSION]).isRequired,\n- platformDetails: platformDetailsPropType.isRequired,\n- time: PropTypes.number.isRequired,\n- mediaMission: mediaMissionPropType.isRequired,\n- uploadServerID: PropTypes.string,\n- uploadLocalID: PropTypes.string,\n- mediaLocalID: PropTypes.string,\n- messageServerID: PropTypes.string,\n- messageLocalID: PropTypes.string,\n- }),\n- PropTypes.shape({\n- type: PropTypes.oneOf([reportTypes.USER_INCONSISTENCY]).isRequired,\n- platformDetails: platformDetailsPropType.isRequired,\n- action: PropTypes.object.isRequired,\n- beforeStateCheck: PropTypes.objectOf(rawThreadInfoPropType).isRequired,\n- afterStateCheck: PropTypes.objectOf(rawThreadInfoPropType).isRequired,\n- lastActions: PropTypes.arrayOf(actionSummaryPropType).isRequired,\n- time: PropTypes.number.isRequired,\n- }),\n-]);\n-\nexport type ReportCreationResponse = {|\nid: string,\n|};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/media-gallery-media.react.js",
"new_path": "native/media/media-gallery-media.react.js",
"diff": "// @flow\nimport LottieView from 'lottie-react-native';\n-import PropTypes from 'prop-types';\nimport * as React from 'react';\nimport {\nTouchableOpacity,\n@@ -19,16 +18,10 @@ import Icon from 'react-native-vector-icons/FontAwesome';\nimport MaterialIcon from 'react-native-vector-icons/MaterialIcons';\nimport Video from 'react-native-video';\n-import {\n- type MediaLibrarySelection,\n- mediaLibrarySelectionPropType,\n-} from 'lib/types/media-types';\n+import { type MediaLibrarySelection } from 'lib/types/media-types';\nimport GestureTouchableOpacity from '../components/gesture-touchable-opacity.react';\n-import {\n- type DimensionsInfo,\n- dimensionsInfoPropType,\n-} from '../redux/dimensions-updater.react';\n+import { type DimensionsInfo } from '../redux/dimensions-updater.react';\nimport type { ViewStyle, ImageStyle } from '../types/styles';\nconst animatedSpec = {\n@@ -53,17 +46,6 @@ type Props = {|\n+dimensions: DimensionsInfo,\n|};\nclass MediaGalleryMedia extends React.PureComponent<Props> {\n- static propTypes = {\n- selection: mediaLibrarySelectionPropType.isRequired,\n- containerHeight: PropTypes.number.isRequired,\n- queueModeActive: PropTypes.bool.isRequired,\n- isQueued: PropTypes.bool.isRequired,\n- setMediaQueued: PropTypes.func.isRequired,\n- sendMedia: PropTypes.func.isRequired,\n- isFocused: PropTypes.bool.isRequired,\n- setFocus: PropTypes.func.isRequired,\n- dimensions: dimensionsInfoPropType.isRequired,\n- };\n// eslint-disable-next-line import/no-named-as-default-member\nfocusProgress = new Reanimated.Value(0);\nbuttonsStyle: ViewStyle;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/multimedia.react.js",
"new_path": "native/media/multimedia.react.js",
"diff": "// @flow\nimport invariant from 'invariant';\n-import PropTypes from 'prop-types';\nimport * as React from 'react';\nimport { View, Image, StyleSheet } from 'react-native';\n-import { type MediaInfo, mediaInfoPropType } from 'lib/types/media-types';\n+import { type MediaInfo } from 'lib/types/media-types';\n-import {\n- type InputState,\n- inputStatePropType,\n- InputStateContext,\n-} from '../input/input-state';\n+import { type InputState, InputStateContext } from '../input/input-state';\nimport RemoteImage from './remote-image.react';\ntype BaseProps = {|\n@@ -28,11 +23,6 @@ type State = {|\n+departingURI: ?string,\n|};\nclass Multimedia extends React.PureComponent<Props, State> {\n- static propTypes = {\n- mediaInfo: mediaInfoPropType.isRequired,\n- spinnerColor: PropTypes.string.isRequired,\n- inputState: inputStatePropType,\n- };\nstatic defaultProps = {\nspinnerColor: 'black',\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-bar.react.js",
"new_path": "web/chat/chat-input-bar.react.js",
"diff": "@@ -5,7 +5,6 @@ import { faChevronRight } from '@fortawesome/free-solid-svg-icons';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport invariant from 'invariant';\nimport _difference from 'lodash/fp/difference';\n-import PropTypes from 'prop-types';\nimport * as React from 'react';\nimport { joinThreadActionTypes, joinThread } from 'lib/actions/thread-actions';\n@@ -19,17 +18,15 @@ import {\nuseRealThreadCreator,\n} from 'lib/shared/thread-utils';\nimport type { CalendarQuery } from 'lib/types/entry-types';\n-import { loadingStatusPropType } from 'lib/types/loading-types';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport { messageTypes } from 'lib/types/message-types';\nimport {\ntype ThreadInfo,\n- threadInfoPropType,\nthreadPermissions,\ntype ClientThreadJoinRequest,\ntype ThreadJoinPayload,\n} from 'lib/types/thread-types';\n-import { type UserInfos, userInfoPropType } from 'lib/types/user-types';\n+import { type UserInfos } from 'lib/types/user-types';\nimport {\ntype DispatchActionPromise,\nuseServerCall,\n@@ -37,7 +34,6 @@ import {\n} from 'lib/utils/action-utils';\nimport {\n- inputStatePropType,\ntype InputState,\ntype PendingMultimediaUpload,\n} from '../input/input-state';\n@@ -70,20 +66,6 @@ type Props = {|\n+getServerThreadID: () => Promise<?string>,\n|};\nclass ChatInputBar extends React.PureComponent<Props> {\n- static propTypes = {\n- threadInfo: threadInfoPropType.isRequired,\n- inputState: inputStatePropType.isRequired,\n- setModal: PropTypes.func.isRequired,\n- viewerID: PropTypes.string,\n- joinThreadLoadingStatus: loadingStatusPropType.isRequired,\n- calendarQuery: PropTypes.func.isRequired,\n- nextLocalID: PropTypes.number.isRequired,\n- isThreadActive: PropTypes.bool.isRequired,\n- userInfos: PropTypes.objectOf(userInfoPropType).isRequired,\n- dispatchActionPromise: PropTypes.func.isRequired,\n- joinThread: PropTypes.func.isRequired,\n- getServerThreadID: PropTypes.func.isRequired,\n- };\ntextarea: ?HTMLTextAreaElement;\nmultimediaInput: ?HTMLInputElement;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/input/input-state.js",
"new_path": "web/input/input-state.js",
"diff": "// @flow\n-import PropTypes from 'prop-types';\nimport * as React from 'react';\nimport {\ntype MediaType,\n- mediaTypePropType,\ntype Dimensions,\n- dimensionsPropType,\ntype MediaMissionStep,\n- mediaMissionStepPropType,\n} from 'lib/types/media-types';\nimport type { RawTextMessageInfo } from 'lib/types/messages/text';\n@@ -36,22 +32,6 @@ export type PendingMultimediaUpload = {|\nsteps: MediaMissionStep[],\nselectTime: number,\n|};\n-const pendingMultimediaUploadPropType = PropTypes.shape({\n- localID: PropTypes.string.isRequired,\n- serverID: PropTypes.string,\n- messageID: PropTypes.string,\n- failed: PropTypes.string,\n- file: PropTypes.object.isRequired,\n- mediaType: mediaTypePropType.isRequired,\n- dimensions: dimensionsPropType,\n- uri: PropTypes.string.isRequired,\n- loop: PropTypes.bool.isRequired,\n- uriIsReal: PropTypes.bool.isRequired,\n- progressPercent: PropTypes.number.isRequired,\n- abort: PropTypes.func,\n- steps: PropTypes.arrayOf(mediaMissionStepPropType).isRequired,\n- selectTime: PropTypes.number.isRequired,\n-});\n// This type represents the input state for a particular thread\nexport type InputState = {|\n@@ -71,29 +51,7 @@ export type InputState = {|\naddReplyListener: ((message: string) => void) => void,\nremoveReplyListener: ((message: string) => void) => void,\n|};\n-const arrayOfUploadsPropType = PropTypes.arrayOf(\n- pendingMultimediaUploadPropType,\n-);\n-const inputStatePropType = PropTypes.shape({\n- pendingUploads: arrayOfUploadsPropType.isRequired,\n- assignedUploads: PropTypes.objectOf(arrayOfUploadsPropType).isRequired,\n- draft: PropTypes.string.isRequired,\n- appendFiles: PropTypes.func.isRequired,\n- cancelPendingUpload: PropTypes.func.isRequired,\n- sendTextMessage: PropTypes.func.isRequired,\n- createMultimediaMessage: PropTypes.func.isRequired,\n- setDraft: PropTypes.func.isRequired,\n- messageHasUploadFailure: PropTypes.func.isRequired,\n- retryMultimediaMessage: PropTypes.func.isRequired,\n- addReply: PropTypes.func.isRequired,\n- addReplyListener: PropTypes.func.isRequired,\n- removeReplyListener: PropTypes.func.isRequired,\n-});\nconst InputStateContext = React.createContext<?InputState>(null);\n-export {\n- pendingMultimediaUploadPropType,\n- inputStatePropType,\n- InputStateContext,\n-};\n+export { InputStateContext };\n"
},
{
"change_type": "MODIFY",
"old_path": "web/media/multimedia.react.js",
"new_path": "web/media/multimedia.react.js",
"diff": "import classNames from 'classnames';\nimport invariant from 'invariant';\n-import PropTypes from 'prop-types';\nimport * as React from 'react';\nimport { CircularProgressbar } from 'react-circular-progressbar';\nimport 'react-circular-progressbar/dist/styles.css';\n@@ -11,10 +10,7 @@ import {\nAlertCircle as AlertCircleIcon,\n} from 'react-feather';\n-import {\n- type PendingMultimediaUpload,\n- pendingMultimediaUploadPropType,\n-} from '../input/input-state';\n+import { type PendingMultimediaUpload } from '../input/input-state';\nimport css from './media.css';\nimport MultimediaModal from './multimedia-modal.react';\n@@ -27,15 +23,6 @@ type Props = {|\nmultimediaImageCSSClass: string,\n|};\nclass Multimedia extends React.PureComponent<Props> {\n- static propTypes = {\n- uri: PropTypes.string.isRequired,\n- pendingUpload: pendingMultimediaUploadPropType,\n- remove: PropTypes.func,\n- setModal: PropTypes.func,\n- multimediaCSSClass: PropTypes.string.isRequired,\n- multimediaImageCSSClass: PropTypes.string.isRequired,\n- };\n-\ncomponentDidUpdate(prevProps: Props) {\nconst { uri, pendingUpload } = this.props;\nif (uri === prevProps.uri) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] [lib] Remove mediaMissionStepPropType
Summary: NA
Test Plan: flow
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D900 |
129,184 | 15.03.2021 12:22:18 | 25,200 | 5fb0686494d2ce5c6a108f3e82cf52d353dfe4b0 | [lib] Make types in `media-types.js` read-only
Summary: NA
Test Plan: flow and careful reading
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/types/media-types.js",
"new_path": "lib/types/media-types.js",
"diff": "@@ -4,68 +4,68 @@ import type { Shape } from './core';\nimport { type Platform } from './device-types';\nexport type Dimensions = $ReadOnly<{|\n- height: number,\n- width: number,\n+ +height: number,\n+ +width: number,\n|}>;\nexport type MediaType = 'photo' | 'video';\nexport type Image = {|\n- id: string,\n- uri: string,\n- type: 'photo',\n- dimensions: Dimensions,\n+ +id: string,\n+ +uri: string,\n+ +type: 'photo',\n+ +dimensions: Dimensions,\n// stored on native only during creation in case retry needed after state lost\n- localMediaSelection?: NativeMediaSelection,\n+ +localMediaSelection?: NativeMediaSelection,\n|};\nexport type Video = {|\n- id: string,\n- uri: string,\n- type: 'video',\n- dimensions: Dimensions,\n- loop?: boolean,\n+ +id: string,\n+ +uri: string,\n+ +type: 'video',\n+ +dimensions: Dimensions,\n+ +loop?: boolean,\n// stored on native only during creation in case retry needed after state lost\n- localMediaSelection?: NativeMediaSelection,\n+ +localMediaSelection?: NativeMediaSelection,\n|};\nexport type Media = Image | Video;\nexport type Corners = Shape<{|\n- topLeft: boolean,\n- topRight: boolean,\n- bottomLeft: boolean,\n- bottomRight: boolean,\n+ +topLeft: boolean,\n+ +topRight: boolean,\n+ +bottomLeft: boolean,\n+ +bottomRight: boolean,\n|}>;\nexport type MediaInfo =\n| {|\n...Image,\n- corners: Corners,\n- index: number,\n+ +corners: Corners,\n+ +index: number,\n|}\n| {|\n...Video,\n- corners: Corners,\n- index: number,\n+ +corners: Corners,\n+ +index: number,\n|};\nexport type UploadMultimediaResult = {|\n- id: string,\n- uri: string,\n- dimensions: Dimensions,\n- mediaType: MediaType,\n- loop: boolean,\n+ +id: string,\n+ +uri: string,\n+ +dimensions: Dimensions,\n+ +mediaType: MediaType,\n+ +loop: boolean,\n|};\nexport type UpdateMultimediaMessageMediaPayload = {|\n- messageID: string,\n- currentMediaID: string,\n- mediaUpdate: Shape<Media>,\n+ +messageID: string,\n+ +currentMediaID: string,\n+ +mediaUpdate: Shape<Media>,\n|};\nexport type UploadDeletionRequest = {|\n- id: string,\n+ +id: string,\n|};\nexport type FFmpegStatistics = {|\n@@ -82,132 +82,132 @@ export type FFmpegStatistics = {|\n|};\nexport type VideoProbeMediaMissionStep = {|\n- step: 'video_probe',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- path: string,\n- validFormat: boolean,\n- duration: ?number, // seconds\n- codec: ?string,\n- format: ?$ReadOnlyArray<string>,\n- dimensions: ?Dimensions,\n+ +step: 'video_probe',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +path: string,\n+ +validFormat: boolean,\n+ +duration: ?number, // seconds\n+ +codec: ?string,\n+ +format: ?$ReadOnlyArray<string>,\n+ +dimensions: ?Dimensions,\n|};\nexport type ReadFileHeaderMediaMissionStep = {|\n- step: 'read_file_header',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- uri: string,\n- mime: ?string,\n- mediaType: ?MediaType,\n+ +step: 'read_file_header',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +uri: string,\n+ +mime: ?string,\n+ +mediaType: ?MediaType,\n|};\nexport type DetermineFileTypeMediaMissionStep = {|\n- step: 'determine_file_type',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- inputFilename: string,\n- outputMIME: ?string,\n- outputMediaType: ?MediaType,\n- outputFilename: ?string,\n+ +step: 'determine_file_type',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +inputFilename: string,\n+ +outputMIME: ?string,\n+ +outputMediaType: ?MediaType,\n+ +outputFilename: ?string,\n|};\nexport type FrameCountMediaMissionStep = {|\n- step: 'frame_count',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number,\n- path: string,\n- mime: string,\n- hasMultipleFrames: ?boolean,\n+ +step: 'frame_count',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number,\n+ +path: string,\n+ +mime: string,\n+ +hasMultipleFrames: ?boolean,\n|};\nexport type DisposeTemporaryFileMediaMissionStep = {|\n- step: 'dispose_temporary_file',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- path: string,\n+ +step: 'dispose_temporary_file',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +path: string,\n|};\nexport type MakeDirectoryMediaMissionStep = {|\n- step: 'make_directory',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- path: string,\n+ +step: 'make_directory',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +path: string,\n|};\nexport type AndroidScanFileMediaMissionStep = {|\n- step: 'android_scan_file',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- path: string,\n+ +step: 'android_scan_file',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +path: string,\n|};\nexport type FetchFileHashMediaMissionStep = {|\n- step: 'fetch_file_hash',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- path: string,\n- hash: ?string,\n+ +step: 'fetch_file_hash',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +path: string,\n+ +hash: ?string,\n|};\nexport type CopyFileMediaMissionStep = {|\n- step: 'copy_file',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- source: string,\n- destination: string,\n+ +step: 'copy_file',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +source: string,\n+ +destination: string,\n|};\nexport type GetOrientationMediaMissionStep = {|\n- step: 'exif_fetch',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- orientation: ?number,\n+ +step: 'exif_fetch',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +orientation: ?number,\n|};\nexport type MediaLibrarySelection =\n| {|\n- step: 'photo_library',\n- dimensions: Dimensions,\n- filename: string,\n- uri: string,\n- mediaNativeID: string,\n- selectTime: number, // ms timestamp\n- sendTime: number, // ms timestamp\n- retries: number,\n- |}\n- | {|\n- step: 'video_library',\n- dimensions: Dimensions,\n- filename: string,\n- uri: string,\n- mediaNativeID: string,\n- selectTime: number, // ms timestamp\n- sendTime: number, // ms timestamp\n- retries: number,\n- duration: number, // seconds\n+ +step: 'photo_library',\n+ +dimensions: Dimensions,\n+ +filename: string,\n+ +uri: string,\n+ +mediaNativeID: string,\n+ +selectTime: number, // ms timestamp\n+ +sendTime: number, // ms timestamp\n+ +retries: number,\n+ |}\n+ | {|\n+ +step: 'video_library',\n+ +dimensions: Dimensions,\n+ +filename: string,\n+ +uri: string,\n+ +mediaNativeID: string,\n+ +selectTime: number, // ms timestamp\n+ +sendTime: number, // ms timestamp\n+ +retries: number,\n+ +duration: number, // seconds\n|};\nexport type PhotoCapture = {|\n- step: 'photo_capture',\n- time: number, // ms\n- dimensions: Dimensions,\n- filename: string,\n- uri: string,\n- captureTime: number, // ms timestamp\n- selectTime: number, // ms timestamp\n- sendTime: number, // ms timestamp\n- retries: number,\n+ +step: 'photo_capture',\n+ +time: number, // ms\n+ +dimensions: Dimensions,\n+ +filename: string,\n+ +uri: string,\n+ +captureTime: number, // ms timestamp\n+ +selectTime: number, // ms timestamp\n+ +sendTime: number, // ms timestamp\n+ +retries: number,\n|};\nexport type PhotoPaste = {|\n@@ -228,269 +228,269 @@ export type NativeMediaSelection =\nexport type MediaMissionStep =\n| NativeMediaSelection\n| {|\n- step: 'web_selection',\n- filename: string,\n- size: number, // in bytes\n- mime: string,\n- selectTime: number, // ms timestamp\n+ +step: 'web_selection',\n+ +filename: string,\n+ +size: number, // in bytes\n+ +mime: string,\n+ +selectTime: number, // ms timestamp\n|}\n| {|\n- step: 'asset_info_fetch',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- localURI: ?string,\n- orientation: ?number,\n+ +step: 'asset_info_fetch',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +localURI: ?string,\n+ +orientation: ?number,\n|}\n| {|\n- step: 'stat_file',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- uri: string,\n- fileSize: ?number,\n+ +step: 'stat_file',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +uri: string,\n+ +fileSize: ?number,\n|}\n| ReadFileHeaderMediaMissionStep\n| DetermineFileTypeMediaMissionStep\n| FrameCountMediaMissionStep\n| {|\n- step: 'photo_manipulation',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- manipulation: Object,\n- newMIME: ?string,\n- newDimensions: ?Dimensions,\n- newURI: ?string,\n+ +step: 'photo_manipulation',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +manipulation: Object,\n+ +newMIME: ?string,\n+ +newDimensions: ?Dimensions,\n+ +newURI: ?string,\n|}\n| VideoProbeMediaMissionStep\n| {|\n- step: 'video_ffmpeg_transcode',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- returnCode: ?number,\n- newPath: ?string,\n- stats: ?FFmpegStatistics,\n+ +step: 'video_ffmpeg_transcode',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +returnCode: ?number,\n+ +newPath: ?string,\n+ +stats: ?FFmpegStatistics,\n|}\n| DisposeTemporaryFileMediaMissionStep\n| {|\n- step: 'save_media',\n- uri: string,\n- time: number, // ms timestamp\n+ +step: 'save_media',\n+ +uri: string,\n+ +time: number, // ms timestamp\n|}\n| {|\n- step: 'permissions_check',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- platform: Platform,\n- permissions: $ReadOnlyArray<string>,\n+ +step: 'permissions_check',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +platform: Platform,\n+ +permissions: $ReadOnlyArray<string>,\n|}\n| MakeDirectoryMediaMissionStep\n| AndroidScanFileMediaMissionStep\n| {|\n- step: 'ios_save_to_library',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- uri: string,\n+ +step: 'ios_save_to_library',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +uri: string,\n|}\n| {|\n- step: 'fetch_blob',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- inputURI: string,\n- uri: string,\n- size: ?number,\n- mime: ?string,\n+ +step: 'fetch_blob',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +inputURI: string,\n+ +uri: string,\n+ +size: ?number,\n+ +mime: ?string,\n|}\n| {|\n- step: 'data_uri_from_blob',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- first255Chars: ?string,\n+ +step: 'data_uri_from_blob',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +first255Chars: ?string,\n|}\n| {|\n- step: 'array_buffer_from_blob',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n+ +step: 'array_buffer_from_blob',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n|}\n| {|\n- step: 'mime_check',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- mime: ?string,\n+ +step: 'mime_check',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +mime: ?string,\n|}\n| {|\n- step: 'write_file',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- path: string,\n- length: number,\n+ +step: 'write_file',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +path: string,\n+ +length: number,\n|}\n| FetchFileHashMediaMissionStep\n| CopyFileMediaMissionStep\n| GetOrientationMediaMissionStep\n| {|\n- step: 'preload_image',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- uri: string,\n- dimensions: ?Dimensions,\n- |}\n- | {|\n- step: 'reorient_image',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- uri: ?string,\n- |}\n- | {|\n- step: 'upload',\n- success: boolean,\n- exceptionMessage: ?string,\n- time: number, // ms\n- inputFilename: string,\n- outputMediaType: ?MediaType,\n- outputURI: ?string,\n- outputDimensions: ?Dimensions,\n- outputLoop: ?boolean,\n- hasWiFi?: boolean,\n- |}\n- | {|\n- step: 'wait_for_capture_uri_unload',\n- success: boolean,\n- time: number, // ms\n- uri: string,\n+ +step: 'preload_image',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +uri: string,\n+ +dimensions: ?Dimensions,\n+ |}\n+ | {|\n+ +step: 'reorient_image',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +uri: ?string,\n+ |}\n+ | {|\n+ +step: 'upload',\n+ +success: boolean,\n+ +exceptionMessage: ?string,\n+ +time: number, // ms\n+ +inputFilename: string,\n+ +outputMediaType: ?MediaType,\n+ +outputURI: ?string,\n+ +outputDimensions: ?Dimensions,\n+ +outputLoop: ?boolean,\n+ +hasWiFi?: boolean,\n+ |}\n+ | {|\n+ +step: 'wait_for_capture_uri_unload',\n+ +success: boolean,\n+ +time: number, // ms\n+ +uri: string,\n|};\nexport type MediaMissionFailure =\n| {|\n- success: false,\n- reason: 'no_file_path',\n+ +success: false,\n+ +reason: 'no_file_path',\n|}\n| {|\n- success: false,\n- reason: 'file_stat_failed',\n- uri: string,\n+ +success: false,\n+ +reason: 'file_stat_failed',\n+ +uri: string,\n|}\n| {|\n- success: false,\n- reason: 'photo_manipulation_failed',\n- size: number, // in bytes\n+ +success: false,\n+ +reason: 'photo_manipulation_failed',\n+ +size: number, // in bytes\n|}\n| {|\n- success: false,\n- reason: 'media_type_fetch_failed',\n- detectedMIME: ?string,\n+ +success: false,\n+ +reason: 'media_type_fetch_failed',\n+ +detectedMIME: ?string,\n|}\n| {|\n- success: false,\n- reason: 'mime_type_mismatch',\n- reportedMediaType: MediaType,\n- reportedMIME: string,\n- detectedMIME: string,\n+ +success: false,\n+ +reason: 'mime_type_mismatch',\n+ +reportedMediaType: MediaType,\n+ +reportedMIME: string,\n+ +detectedMIME: string,\n|}\n| {|\n- success: false,\n- reason: 'http_upload_failed',\n- exceptionMessage: ?string,\n+ +success: false,\n+ +reason: 'http_upload_failed',\n+ +exceptionMessage: ?string,\n|}\n| {|\n- success: false,\n- reason: 'video_too_long',\n- duration: number, // in seconds\n+ +success: false,\n+ +reason: 'video_too_long',\n+ +duration: number, // in seconds\n|}\n| {|\n- success: false,\n- reason: 'video_probe_failed',\n+ +success: false,\n+ +reason: 'video_probe_failed',\n|}\n| {|\n- success: false,\n- reason: 'video_transcode_failed',\n+ +success: false,\n+ +reason: 'video_transcode_failed',\n|}\n| {|\n- success: false,\n- reason: 'processing_exception',\n- time: number, // ms\n- exceptionMessage: ?string,\n+ +success: false,\n+ +reason: 'processing_exception',\n+ +time: number, // ms\n+ +exceptionMessage: ?string,\n|}\n| {|\n- success: false,\n- reason: 'save_unsupported',\n+ +success: false,\n+ +reason: 'save_unsupported',\n|}\n| {|\n- success: false,\n- reason: 'missing_permission',\n+ +success: false,\n+ +reason: 'missing_permission',\n|}\n| {|\n- success: false,\n- reason: 'make_directory_failed',\n+ +success: false,\n+ +reason: 'make_directory_failed',\n|}\n| {|\n- success: false,\n- reason: 'resolve_failed',\n- uri: string,\n+ +success: false,\n+ +reason: 'resolve_failed',\n+ +uri: string,\n|}\n| {|\n- success: false,\n- reason: 'save_to_library_failed',\n- uri: string,\n+ +success: false,\n+ +reason: 'save_to_library_failed',\n+ +uri: string,\n|}\n| {|\n- success: false,\n- reason: 'fetch_failed',\n+ +success: false,\n+ +reason: 'fetch_failed',\n|}\n| {|\n- success: false,\n- reason: 'data_uri_failed',\n+ +success: false,\n+ +reason: 'data_uri_failed',\n|}\n| {|\n- success: false,\n- reason: 'array_buffer_failed',\n+ +success: false,\n+ +reason: 'array_buffer_failed',\n|}\n| {|\n- success: false,\n- reason: 'mime_check_failed',\n- mime: ?string,\n+ +success: false,\n+ +reason: 'mime_check_failed',\n+ +mime: ?string,\n|}\n| {|\n- success: false,\n- reason: 'write_file_failed',\n+ +success: false,\n+ +reason: 'write_file_failed',\n|}\n| {|\n- success: false,\n- reason: 'fetch_file_hash_failed',\n+ +success: false,\n+ +reason: 'fetch_file_hash_failed',\n|}\n| {|\n- success: false,\n- reason: 'copy_file_failed',\n+ +success: false,\n+ +reason: 'copy_file_failed',\n|}\n| {|\n- success: false,\n- reason: 'exif_fetch_failed',\n+ +success: false,\n+ +reason: 'exif_fetch_failed',\n|}\n| {|\n- success: false,\n- reason: 'reorient_image_failed',\n+ +success: false,\n+ +reason: 'reorient_image_failed',\n|}\n| {|\n- success: false,\n- reason: 'web_sibling_validation_failed',\n+ +success: false,\n+ +reason: 'web_sibling_validation_failed',\n|};\n-export type MediaMissionResult = MediaMissionFailure | {| success: true |};\n+export type MediaMissionResult = MediaMissionFailure | {| +success: true |};\nexport type MediaMission = {|\n- steps: $ReadOnlyArray<MediaMissionStep>,\n- result: MediaMissionResult,\n- userTime: number,\n- totalTime: number,\n+ +steps: $ReadOnlyArray<MediaMissionStep>,\n+ +result: MediaMissionResult,\n+ +userTime: number,\n+ +totalTime: number,\n|};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Make types in `media-types.js` read-only
Summary: NA
Test Plan: flow and careful reading
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D909 |
129,184 | 15.03.2021 00:24:53 | 25,200 | 9715833c3d94d13aec2541670be4667837d6827d | [native] Introduce generateThumbnail, rename FFmpeg:process to FFmpeg:trancodeVideo
Summary: Introduce `generateThumbnail` and rename `FFmpeg:process` to `FFmpeg:transcodeVideo`
Test Plan: verified thumbnail was generated by checking the console.log'd output path.
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "native/media/ffmpeg.js",
"new_path": "native/media/ffmpeg.js",
"diff": "@@ -74,7 +74,7 @@ class FFmpeg {\ntoRun.forEach(({ runCommand }) => runCommand());\n}\n- process(\n+ transcodeVideo(\nffmpegCommand: string,\ninputVideoDuration: number,\nonTranscodingProgress: (percent: number) => void,\n@@ -96,6 +96,18 @@ class FFmpeg {\nreturn this.queueCommand('process', wrappedCommand);\n}\n+ generateThumbnail(videoPath: string, outputPath: string) {\n+ const wrappedCommand = () =>\n+ FFmpeg.innerGenerateThumbnail(videoPath, outputPath);\n+ return this.queueCommand('process', wrappedCommand);\n+ }\n+\n+ static async innerGenerateThumbnail(videoPath: string, outputPath: string) {\n+ const thumbnailCommand = `-i ${videoPath} -frames 1 -f singlejpeg ${outputPath}`;\n+ const { rc } = await RNFFmpeg.execute(thumbnailCommand);\n+ return rc;\n+ }\n+\ngetVideoInfo(path: string) {\nconst wrappedCommand = () => FFmpeg.innerGetVideoInfo(path);\nreturn this.queueCommand('probe', wrappedCommand);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/video-utils.js",
"new_path": "native/media/video-utils.js",
"diff": "@@ -112,7 +112,7 @@ async function processVideo(\nexceptionMessage;\nconst start = Date.now();\ntry {\n- const { rc, lastStats } = await ffmpeg.process(\n+ const { rc, lastStats } = await ffmpeg.transcodeVideo(\nffmpegCommand,\nduration,\nconfig.onTranscodingProgress,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Introduce generateThumbnail, rename FFmpeg:process to FFmpeg:trancodeVideo
Summary: Introduce `generateThumbnail` and rename `FFmpeg:process` to `FFmpeg:transcodeVideo`
Test Plan: verified thumbnail was generated by checking the console.log'd output path.
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D899 |
129,191 | 16.03.2021 16:38:08 | -3,600 | 1d1fc53b7109d9badf86eff4a75377a0be7ef097 | [lib] Remove unused variable
Test Plan: Flow
Reviewers: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/reducers/master-reducer.js",
"new_path": "lib/reducers/master-reducer.js",
"diff": "@@ -64,7 +64,7 @@ export default function baseReducer<N: BaseNavInfo, T: BaseAppState<N>>(\ncurrentUserInfo: reduceCurrentUserInfo(state.currentUserInfo, action),\nthreadStore,\nuserStore: reduceUserInfos(state.userStore, action),\n- messageStore: reduceMessageStore(state.messageStore, action, threadInfos),\n+ messageStore,\nupdatesCurrentAsOf,\nurlPrefix: reduceURLPrefix(state.urlPrefix, action),\ncalendarFilters: reduceCalendarFilters(state.calendarFilters, action),\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Remove unused variable
Test Plan: Flow
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D908 |
129,191 | 09.03.2021 11:36:03 | -3,600 | e042b28a1db94587754ab9010730c9c41103afd9 | [native] Include messages from store in pending sidebar
Test Plan: Modify thread creator to always fail, send a message to pending sidebar and check if it was displayed
Reviewers: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/selectors/chat-selectors.js",
"new_path": "lib/selectors/chat-selectors.js",
"diff": "@@ -5,7 +5,6 @@ import _filter from 'lodash/fp/filter';\nimport _flow from 'lodash/fp/flow';\nimport _map from 'lodash/fp/map';\nimport _orderBy from 'lodash/fp/orderBy';\n-import _memoize from 'lodash/memoize';\nimport * as React from 'react';\nimport { useSelector } from 'react-redux';\nimport { createSelector } from 'reselect';\n@@ -16,6 +15,7 @@ import {\nrobotextForMessageInfo,\ncreateMessageInfo,\ngetMostRecentNonLocalMessageID,\n+ sortMessageInfoList,\n} from '../shared/message-utils';\nimport {\nthreadIsTopLevel,\n@@ -42,6 +42,7 @@ import {\n} from '../types/thread-types';\nimport type { UserInfo, AccountUserInfo } from '../types/user-types';\nimport { threeDays } from '../utils/date-utils';\n+import memoize2 from '../utils/memoize';\nimport {\nthreadInfoSelector,\nsidebarInfoSelector,\n@@ -264,18 +265,25 @@ function createChatMessageItems(\nmessageInfos: { [id: string]: MessageInfo },\nthreadInfos: { [id: string]: ThreadInfo },\nthreadInfoFromSourceMessageID: { [id: string]: ThreadInfo },\n+ additionalMessages: $ReadOnlyArray<MessageInfo>,\n): ChatMessageItem[] {\nconst thread = messageStore.threads[threadID];\n- if (!thread) {\n- return [];\n- }\n- const threadMessageInfos = thread.messageIDs\n+\n+ const threadMessageInfos = (thread?.messageIDs ?? [])\n.map((messageID: string) => messageInfos[messageID])\n.filter(Boolean);\n+ const messages =\n+ additionalMessages.length > 0\n+ ? sortMessageInfoList([...threadMessageInfos, ...additionalMessages])\n+ : threadMessageInfos;\n+ if (messages.length === 0) {\n+ return [];\n+ }\n+\nconst chatMessageItems = [];\nlet lastMessageInfo = null;\n- for (let i = threadMessageInfos.length - 1; i >= 0; i--) {\n- const messageInfo = threadMessageInfos[i];\n+ for (let i = messages.length - 1; i >= 0; i--) {\n+ const messageInfo = messages[i];\nconst originalMessageInfo =\nmessageInfo.type === messageTypes.SIDEBAR_SOURCE\n? messageInfo.sourceMessage\n@@ -353,13 +361,16 @@ function createChatMessageItems(\nlastMessageItem.endsCluster = true;\n}\nchatMessageItems.reverse();\n- if (thread.startReached) {\n+ if (thread?.startReached ?? true) {\nreturn chatMessageItems;\n}\nreturn [...chatMessageItems, ({ itemType: 'loader' }: ChatMessageItem)];\n}\n-const baseMessageListData = (threadID: ?string) =>\n+const baseMessageListData = (\n+ threadID: ?string,\n+ additionalMessages: $ReadOnlyArray<MessageInfo>,\n+) =>\ncreateSelector(\n(state: BaseAppState<*>) => state.messageStore,\nmessageInfoSelector,\n@@ -380,60 +391,17 @@ const baseMessageListData = (threadID: ?string) =>\nmessageInfos,\nthreadInfos,\nthreadInfoFromSourceMessageID,\n+ additionalMessages,\n);\n},\n);\nconst messageListData: (\nthreadID: ?string,\n-) => (state: BaseAppState<*>) => ?(ChatMessageItem[]) = _memoize(\n+ additionalMessages: $ReadOnlyArray<MessageInfo>,\n+) => (state: BaseAppState<*>) => ?(ChatMessageItem[]) = memoize2(\nbaseMessageListData,\n);\n-function getSourceMessageChatItemForPendingSidebar(\n- messageInfo: ComposableMessageInfo | RobotextMessageInfo,\n- threadInfos: { [id: string]: ThreadInfo },\n-): ChatMessageInfoItem {\n- if (isComposableMessageType(messageInfo.type)) {\n- invariant(\n- messageInfo.type === messageTypes.TEXT ||\n- messageInfo.type === messageTypes.IMAGES ||\n- messageInfo.type === messageTypes.MULTIMEDIA,\n- \"Flow doesn't understand isComposableMessageType above\",\n- );\n- const messageItem = {\n- itemType: 'message',\n- messageInfo: messageInfo,\n- startsConversation: true,\n- startsCluster: true,\n- endsCluster: true,\n- localMessageInfo: null,\n- threadCreatedFromMessage: undefined,\n- };\n- return messageItem;\n- } else {\n- invariant(\n- messageInfo.type !== messageTypes.TEXT &&\n- messageInfo.type !== messageTypes.IMAGES &&\n- messageInfo.type !== messageTypes.MULTIMEDIA,\n- \"Flow doesn't understand isComposableMessageType above\",\n- );\n- const robotext = robotextForMessageInfo(\n- messageInfo,\n- threadInfos[messageInfo.threadID],\n- );\n- const messageItem = {\n- itemType: 'message',\n- messageInfo: messageInfo,\n- startsConversation: true,\n- startsCluster: true,\n- endsCluster: true,\n- threadCreatedFromMessage: undefined,\n- robotext,\n- };\n- return messageItem;\n- }\n-}\n-\ntype UseMessageListDataArgs = {|\n+sourceMessageID: ?string,\n+searching: boolean,\n@@ -447,7 +415,6 @@ function useMessageListData({\nuserInfoInputArray,\nthreadInfo,\n}: UseMessageListDataArgs) {\n- const threadInfos = useSelector(threadInfoSelector);\nconst sidebarCandidate = useSidebarCandidate(sourceMessageID);\nconst sidebarSourceMessageInfo = useSelector((state) =>\nsourceMessageID && !sidebarCandidate && threadIsPendingSidebar(threadInfo)\n@@ -459,27 +426,21 @@ function useMessageListData({\nsidebarSourceMessageInfo.type !== messageTypes.SIDEBAR_SOURCE,\n'sidebars can not be created from sidebar_source message',\n);\n- const boundMessageListData = useSelector(messageListData(threadInfo?.id));\n+\n+ const additionalMessages = React.useMemo(\n+ () => (sidebarSourceMessageInfo ? [sidebarSourceMessageInfo] : []),\n+ [sidebarSourceMessageInfo],\n+ );\n+ const boundMessageListData = useSelector(\n+ messageListData(threadInfo?.id, additionalMessages),\n+ );\nreturn React.useMemo(() => {\nif (searching && userInfoInputArray.length === 0) {\nreturn [];\n- } else if (sidebarSourceMessageInfo) {\n- return [\n- getSourceMessageChatItemForPendingSidebar(\n- sidebarSourceMessageInfo,\n- threadInfos,\n- ),\n- ];\n}\nreturn boundMessageListData;\n- }, [\n- searching,\n- userInfoInputArray.length,\n- sidebarSourceMessageInfo,\n- boundMessageListData,\n- threadInfos,\n- ]);\n+ }, [searching, userInfoInputArray.length, boundMessageListData]);\n}\nexport {\n@@ -489,6 +450,5 @@ export {\ncreateChatMessageItems,\nmessageListData,\nuseFlattenedChatListData,\n- getSourceMessageChatItemForPendingSidebar,\nuseMessageListData,\n};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/utils/memoize.js",
"diff": "+// @flow\n+\n+import _memoize from 'lodash/memoize';\n+\n+export default function memoize2<T, U, V>(\n+ f: (t: T, u: U) => V,\n+): (t: T, u: U) => V {\n+ const memoized = _memoize<[T], (U) => V>((t: T) =>\n+ _memoize<[U], V>((u: U) => f(t, u)),\n+ );\n+ return (t: T, u: U) => memoized(t)(u);\n+}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Include messages from store in pending sidebar
Test Plan: Modify thread creator to always fail, send a message to pending sidebar and check if it was displayed
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D843 |
129,183 | 15.03.2021 09:52:04 | -3,600 | dd874fe1b217170128e2b096ef51013aa5db52d8 | [web] Use ColorResult type
Summary: Follow up to D892 and type changes made there
Test Plan: Flow
Reviewers: palys-swm, ashoat
Subscribers: ashoat, zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "web/modals/threads/color-picker.react.js",
"new_path": "web/modals/threads/color-picker.react.js",
"diff": "// @flow\nimport * as React from 'react';\n-import { ChromePicker } from 'react-color';\n+import { type ColorResult, ChromePicker } from 'react-color';\nimport css from '../../style.css';\n@@ -14,10 +14,6 @@ type Props = {|\ntype State = {|\n+pickerOpen: boolean,\n|};\n-type Color = {\n- +hex: string,\n- ...\n-};\nclass ColorPicker extends React.PureComponent<Props, State> {\nprops: Props;\n@@ -68,7 +64,7 @@ class ColorPicker extends React.PureComponent<Props, State> {\n}\n};\n- onChangeColor = (color: Color) => {\n+ onChangeColor = (color: ColorResult) => {\nthis.props.onChange(color.hex.substring(1, 7));\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Use ColorResult type
Summary: Follow up to D892 and type changes made there
Test Plan: Flow
Reviewers: palys-swm, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D907 |
129,184 | 18.03.2021 08:39:43 | 25,200 | e3975e26cb8b79ba08a5d9dc6d592d341e066ccd | [native] Make types ReadOnly in media-utils/video-utils
Summary: NA
Test Plan: Flow
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "native/media/media-utils.js",
"new_path": "native/media/media-utils.js",
"diff": "@@ -18,20 +18,20 @@ import { saveMedia } from './save-media';\nimport { processVideo } from './video-utils';\ntype MediaProcessConfig = {|\n- hasWiFi: boolean,\n+ +hasWiFi: boolean,\n// Blocks return until we can confirm result has the correct MIME\n- finalFileHeaderCheck?: boolean,\n- onTranscodingProgress: (percent: number) => void,\n+ +finalFileHeaderCheck?: boolean,\n+ +onTranscodingProgress: (percent: number) => void,\n|};\ntype MediaResult = {|\n- success: true,\n- uploadURI: string,\n- shouldDisposePath: ?string,\n- filename: string,\n- mime: string,\n- mediaType: MediaType,\n- dimensions: Dimensions,\n- loop: boolean,\n+ +success: true,\n+ +uploadURI: string,\n+ +shouldDisposePath: ?string,\n+ +filename: string,\n+ +mime: string,\n+ +mediaType: MediaType,\n+ +dimensions: Dimensions,\n+ +loop: boolean,\n|};\nfunction processMedia(\nselection: NativeMediaSelection,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/video-utils.js",
"new_path": "native/media/video-utils.js",
"diff": "@@ -25,12 +25,12 @@ const uploadSpeeds = Object.freeze({\nconst clientTranscodeSpeed = 1.15; // in seconds of video transcoded per second\ntype ProcessVideoInfo = {|\n- uri: string,\n- mime: string,\n- filename: string,\n- fileSize: number,\n- dimensions: Dimensions,\n- hasWiFi: boolean,\n+ +uri: string,\n+ +mime: string,\n+ +filename: string,\n+ +fileSize: number,\n+ +dimensions: Dimensions,\n+ +hasWiFi: boolean,\n|};\ntype VideoProcessConfig = {|\n@@ -38,11 +38,11 @@ type VideoProcessConfig = {|\n|};\ntype ProcessVideoResponse = {|\n- success: true,\n- uri: string,\n- mime: string,\n- dimensions: Dimensions,\n- loop: boolean,\n+ +success: true,\n+ +uri: string,\n+ +mime: string,\n+ +dimensions: Dimensions,\n+ +loop: boolean,\n|};\nasync function processVideo(\ninput: ProcessVideoInfo,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Make types ReadOnly in media-utils/video-utils
Summary: NA
Test Plan: Flow
Reviewers: ashoat, palys-swm
Reviewed By: palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D919 |
129,184 | 18.03.2021 10:55:20 | 25,200 | edbc6e8ea141a672d13db0740ef9e1aa719da8cb | [native] Add getTempDirectoryPath to native/file-utils
Summary: NA
Test Plan: flow and continues to work as expected
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "native/media/file-utils.js",
"new_path": "native/media/file-utils.js",
"diff": "@@ -425,9 +425,15 @@ async function copyFile(\n};\n}\n+const temporaryDirectoryPath: string = Platform.select({\n+ ios: filesystem.TemporaryDirectoryPath,\n+ default: `${filesystem.TemporaryDirectoryPath}/`,\n+});\n+\nexport {\nfetchAssetInfo,\nfetchFileInfo,\n+ temporaryDirectoryPath,\ndisposeTempFile,\nmkdir,\nandroidScanFile,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/save-media.js",
"new_path": "native/media/save-media.js",
"diff": "@@ -32,6 +32,7 @@ import {\nandroidScanFile,\nfetchFileHash,\ncopyFile,\n+ temporaryDirectoryPath,\n} from './file-utils';\nimport { getMediaLibraryIdentifier } from './identifier-utils';\n@@ -194,10 +195,7 @@ async function saveMediaAndroid(\nconst {\nresult: tempSaveResult,\nsteps: tempSaveSteps,\n- } = await saveRemoteMediaToDisk(\n- uri,\n- `${filesystem.TemporaryDirectoryPath}/`,\n- );\n+ } = await saveRemoteMediaToDisk(uri, temporaryDirectoryPath);\nsteps.push(...tempSaveSteps);\nif (!tempSaveResult.success) {\nsuccess = false;\n@@ -263,7 +261,7 @@ async function saveMediaIOS(\nconst {\nresult: tempSaveResult,\nsteps: tempSaveSteps,\n- } = await saveRemoteMediaToDisk(uri, filesystem.TemporaryDirectoryPath);\n+ } = await saveRemoteMediaToDisk(uri, temporaryDirectoryPath);\nsteps.push(...tempSaveSteps);\nif (!tempSaveResult.success) {\nsendResult(tempSaveResult);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/video-utils.js",
"new_path": "native/media/video-utils.js",
"diff": "@@ -15,6 +15,7 @@ import type {\nimport { getMessageForException } from 'lib/utils/errors';\nimport { ffmpeg } from './ffmpeg';\n+import { temporaryDirectoryPath } from './file-utils';\n// These are some numbers I sorta kinda made up\n// We should try to calculate them on a per-device basis\n@@ -70,10 +71,7 @@ async function processVideo(\ninputFilename: input.filename,\ninputDuration: duration,\ninputDimensions: input.dimensions,\n- outputDirectory: Platform.select({\n- ios: filesystem.TemporaryDirectoryPath,\n- default: `${filesystem.TemporaryDirectoryPath}/`,\n- }),\n+ outputDirectory: temporaryDirectoryPath,\n// We want ffmpeg to use hardware-accelerated encoders. On iOS we can do\n// this using VideoToolbox, but ffmpeg on Android is still missing\n// MediaCodec encoding support: https://trac.ffmpeg.org/ticket/6407\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Add getTempDirectoryPath to native/file-utils
Summary: NA
Test Plan: flow and continues to work as expected
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D920 |
129,184 | 18.03.2021 12:58:47 | 25,200 | f282e7907cf7ecc59e2feb307823ed823248b3fe | [native] Make types ReadOnly in lib/media/video-utils
Summary: NA
Test Plan: Flow
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/media/video-utils.js",
"new_path": "lib/media/video-utils.js",
"diff": "@@ -12,28 +12,28 @@ const { height: maxHeight, width: maxWidth } = maxDimensions;\nconst estimatedResultBitrate = 0.35; // in MiB/s\ntype Input = {|\n- inputPath: string,\n- inputHasCorrectContainerAndCodec: boolean,\n- inputFileSize: number, // in bytes\n- inputFilename: string,\n- inputDuration: number,\n- inputDimensions: Dimensions,\n- outputDirectory: string,\n- outputCodec: string,\n- clientConnectionInfo?: {|\n- hasWiFi: boolean,\n- speed: number, // in kilobytes per second\n+ +inputPath: string,\n+ +inputHasCorrectContainerAndCodec: boolean,\n+ +inputFileSize: number, // in bytes\n+ +inputFilename: string,\n+ +inputDuration: number,\n+ +inputDimensions: Dimensions,\n+ +outputDirectory: string,\n+ +outputCodec: string,\n+ +clientConnectionInfo?: {|\n+ +hasWiFi: boolean,\n+ +speed: number, // in kilobytes per second\n|},\n- clientTranscodeSpeed?: number, // in input video seconds per second\n+ +clientTranscodeSpeed?: number, // in input video seconds per second\n|};\nexport type ProcessPlan = {|\n- action: 'process',\n- outputPath: string,\n- ffmpegCommand: string,\n+ +action: 'process',\n+ +outputPath: string,\n+ +ffmpegCommand: string,\n|};\ntype Plan =\n- | {| action: 'none' |}\n- | {| action: 'reject', failure: MediaMissionFailure |}\n+ | {| +action: 'none' |}\n+ | {| +action: 'reject', +failure: MediaMissionFailure |}\n| ProcessPlan;\nfunction getVideoProcessingPlan(input: Input): Plan {\nconst {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Make types ReadOnly in lib/media/video-utils
Summary: NA
Test Plan: Flow
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D922 |
129,191 | 18.03.2021 13:33:35 | -3,600 | f61f49a5549de45ea5b38520b3c275422b634f34 | [lib] Use correct parameter type in createPendingSidebar function
Summary: We should use the same type as in SidebarSourceMessageInfo type definition
Test Plan: Flow
Reviewers: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/thread-utils.js",
"new_path": "lib/shared/thread-utils.js",
"diff": "@@ -25,11 +25,9 @@ import {\nthreadInfoFromSourceMessageIDSelector,\n} from '../selectors/thread-selectors';\nimport type {\n- MultimediaMessageInfo,\nRobotextMessageInfo,\nComposableMessageInfo,\n} from '../types/message-types';\n-import type { TextMessageInfo } from '../types/messages/text';\nimport { userRelationshipStatus } from '../types/relationship-types';\nimport {\ntype RawThreadInfo,\n@@ -373,7 +371,7 @@ function createPendingThreadItem(\n}\nfunction createPendingSidebar(\n- messageInfo: TextMessageInfo | MultimediaMessageInfo | RobotextMessageInfo,\n+ messageInfo: ComposableMessageInfo | RobotextMessageInfo,\nthreadInfo: ThreadInfo,\nviewerID: string,\nmarkdownRules: ParserRules,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Use correct parameter type in createPendingSidebar function
Summary: We should use the same type as in SidebarSourceMessageInfo type definition
Test Plan: Flow
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D918 |
129,184 | 19.03.2021 01:13:03 | 25,200 | 1839ac5c7c470040271d3d26a5e07701a576f219 | [native] Add thumbnail generation step to processVideo
Summary: Added thumbnail generation step to `processVideo`
Test Plan: Got path to `thumbnailURI` via `console.log` and made sure the JPG existed/looked correct visually.
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/media/video-utils.js",
"new_path": "lib/media/video-utils.js",
"diff": "@@ -29,10 +29,11 @@ type Input = {|\nexport type ProcessPlan = {|\n+action: 'process',\n+outputPath: string,\n+ +thumbnailPath: string,\n+ffmpegCommand: string,\n|};\ntype Plan =\n- | {| +action: 'none' |}\n+ | {| +action: 'none', +thumbnailPath: string |}\n| {| +action: 'reject', +failure: MediaMissionFailure |}\n| ProcessPlan;\nfunction getVideoProcessingPlan(input: Input): Plan {\n@@ -60,9 +61,15 @@ function getVideoProcessingPlan(input: Input): Plan {\n};\n}\n+ const uuid = getUUID();\n+ const thumbnailFilename = replaceExtension(\n+ `thumb.${uuid}.${inputFilename}`,\n+ 'jpg',\n+ );\n+ const thumbnailPath = `${outputDirectory}${thumbnailFilename}`;\nif (inputHasCorrectContainerAndCodec) {\nif (inputFileSize < 1e7) {\n- return { action: 'none' };\n+ return { action: 'none', thumbnailPath };\n}\nif (clientConnectionInfo && clientTranscodeSpeed) {\nconst rawUploadTime = inputFileSize / 1024 / clientConnectionInfo.speed; // in seconds\n@@ -76,13 +83,13 @@ function getVideoProcessingPlan(input: Input): Plan {\n(clientConnectionInfo.hasWiFi && rawUploadTime < fullProcessTime) ||\n(inputFileSize < 1e8 && rawUploadTime * 2 < fullProcessTime)\n) {\n- return { action: 'none' };\n+ return { action: 'none', thumbnailPath };\n}\n}\n}\nconst outputFilename = replaceExtension(\n- `transcode.${getUUID()}.${inputFilename}`,\n+ `transcode.${uuid}.${inputFilename}`,\n'mp4',\n);\nconst outputPath = `${outputDirectory}${outputFilename}`;\n@@ -121,7 +128,7 @@ function getVideoProcessingPlan(input: Input): Plan {\n'-v quiet ' +\noutputPath;\n- return { action: 'process', outputPath, ffmpegCommand };\n+ return { action: 'process', thumbnailPath, outputPath, ffmpegCommand };\n}\nfunction getHasMultipleFramesProbeCommand(path: string) {\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/types/media-types.js",
"new_path": "lib/types/media-types.js",
"diff": "@@ -91,6 +91,14 @@ export type TranscodeVideoMediaMissionStep = {|\n+stats: ?FFmpegStatistics,\n|};\n+export type VideoGenerateThumbnailMediaMissionStep = {|\n+ +step: 'video_generate_thumbnail',\n+ +success: boolean,\n+ +time: number, // ms\n+ +returnCode: number,\n+ +thumbnailURI: string,\n+|};\n+\nexport type VideoProbeMediaMissionStep = {|\n+step: 'video_probe',\n+success: boolean,\n@@ -275,6 +283,7 @@ export type MediaMissionStep =\n|}\n| VideoProbeMediaMissionStep\n| TranscodeVideoMediaMissionStep\n+ | VideoGenerateThumbnailMediaMissionStep\n| DisposeTemporaryFileMediaMissionStep\n| {|\n+step: 'save_media',\n@@ -418,6 +427,10 @@ export type MediaMissionFailure =\n+success: false,\n+reason: 'video_transcode_failed',\n|}\n+ | {|\n+ +success: false,\n+ +reason: 'video_generate_thumbnail_failed',\n+ |}\n| {|\n+success: false,\n+reason: 'processing_exception',\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/media-utils.js",
"new_path": "native/media/media-utils.js",
"diff": "import invariant from 'invariant';\nimport { Image } from 'react-native';\n+import { unlink } from 'react-native-fs';\nimport { pathFromURI, readableFilename } from 'lib/media/file-utils';\nimport type {\n@@ -26,6 +27,7 @@ type MediaProcessConfig = {|\ntype MediaResult = {|\n+success: true,\n+uploadURI: string,\n+ +thumbnailURI: ?string,\n+shouldDisposePath: ?string,\n+filename: string,\n+mime: string,\n@@ -62,6 +64,7 @@ async function innerProcessMedia(\n): Promise<$ReadOnlyArray<MediaMissionStep>> {\nlet initialURI = null,\nuploadURI = null,\n+ thumbnailURI = null,\ndimensions = selection.dimensions,\nmediaType = null,\nmime = null,\n@@ -88,6 +91,7 @@ async function innerProcessMedia(\nsendResult({\nsuccess: true,\nuploadURI,\n+ thumbnailURI,\nshouldDisposePath,\nfilename,\nmime,\n@@ -167,7 +171,10 @@ async function innerProcessMedia(\nif (!videoResult.success) {\nreturn await finish(videoResult);\n}\n- ({ uri: uploadURI, mime, dimensions, loop } = videoResult);\n+ ({ uri: uploadURI, thumbnailURI, mime, dimensions, loop } = videoResult);\n+ // unlink the thumbnailURI so we don't clog up temp dir\n+ // we use thumbnailURI in subsequent diffs\n+ unlink(thumbnailURI);\n} else if (mediaType === 'photo') {\nconst { steps: imageSteps, result: imageResult } = await processImage({\nuri: initialURI,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/video-utils.js",
"new_path": "native/media/video-utils.js",
"diff": "@@ -12,6 +12,7 @@ import type {\nMediaMissionFailure,\nVideoProbeMediaMissionStep,\nTranscodeVideoMediaMissionStep,\n+ VideoGenerateThumbnailMediaMissionStep,\nDimensions,\n} from 'lib/types/media-types';\nimport { getMessageForException } from 'lib/utils/errors';\n@@ -43,6 +44,7 @@ type VideoProcessConfig = {|\ntype ProcessVideoResponse = {|\n+success: true,\n+uri: string,\n+ +thumbnailURI: string,\n+mime: string,\n+dimensions: Dimensions,\n+loop: boolean,\n@@ -92,36 +94,62 @@ async function processVideo(\nreturn { steps, result: plan.failure };\n}\nif (plan.action === 'none') {\n+ const thumbnailStep = await generateThumbnail(path, plan.thumbnailPath);\n+ steps.push(thumbnailStep);\n+ if (!thumbnailStep.success) {\n+ unlink(plan.thumbnailPath);\n+ return {\n+ steps,\n+ result: { success: false, reason: 'video_generate_thumbnail_failed' },\n+ };\n+ }\nreturn {\nsteps,\nresult: {\nsuccess: true,\nuri: input.uri,\n+ thumbnailURI: `file://${plan.thumbnailPath}`,\nmime: 'video/mp4',\ndimensions: input.dimensions,\nloop: false,\n},\n};\n}\n- const { outputPath } = plan;\n- const transcodeStep = await transcodeVideo(\n- plan,\n- duration,\n- config.onTranscodingProgress,\n- );\n- steps.push(transcodeStep);\n+ const [thumbnailStep, transcodeStep] = await Promise.all([\n+ generateThumbnail(path, plan.thumbnailPath),\n+ transcodeVideo(plan, duration, config.onTranscodingProgress),\n+ ]);\n+ steps.push(thumbnailStep, transcodeStep);\n+\n+ if (!thumbnailStep.success) {\n+ unlink(plan.outputPath);\n+ unlink(plan.thumbnailPath);\n+ return {\n+ steps,\n+ result: {\n+ success: false,\n+ reason: 'video_generate_thumbnail_failed',\n+ },\n+ };\n+ }\nif (!transcodeStep.success) {\n+ unlink(plan.outputPath);\n+ unlink(plan.thumbnailPath);\nreturn {\nsteps,\n- result: { success: false, reason: 'video_transcode_failed' },\n+ result: {\n+ success: false,\n+ reason: 'video_transcode_failed',\n+ },\n};\n}\n- const transcodeProbeStep = await checkVideoInfo(outputPath);\n+ const transcodeProbeStep = await checkVideoInfo(plan.outputPath);\nsteps.push(transcodeProbeStep);\nif (!transcodeProbeStep.validFormat) {\n- unlink(outputPath);\n+ unlink(plan.outputPath);\n+ unlink(plan.thumbnailPath);\nreturn {\nsteps,\nresult: { success: false, reason: 'video_transcode_failed' },\n@@ -140,7 +168,8 @@ async function processVideo(\nsteps,\nresult: {\nsuccess: true,\n- uri: `file://${outputPath}`,\n+ uri: `file://${plan.outputPath}`,\n+ thumbnailURI: `file://${plan.thumbnailPath}`,\nmime: 'video/mp4',\ndimensions,\nloop,\n@@ -148,6 +177,25 @@ async function processVideo(\n};\n}\n+async function generateThumbnail(\n+ path: string,\n+ thumbnailPath: string,\n+): Promise<VideoGenerateThumbnailMediaMissionStep> {\n+ const thumbnailStart = Date.now();\n+ const thumbnailReturnCode = await ffmpeg.generateThumbnail(\n+ path,\n+ thumbnailPath,\n+ );\n+ const thumbnailGenerationSuccessful = thumbnailReturnCode === 0;\n+ return {\n+ step: 'video_generate_thumbnail',\n+ success: thumbnailGenerationSuccessful,\n+ time: Date.now() - thumbnailStart,\n+ returnCode: thumbnailReturnCode,\n+ thumbnailURI: thumbnailPath,\n+ };\n+}\n+\nasync function transcodeVideo(\nplan: ProcessPlan,\nduration: number,\n@@ -174,9 +222,6 @@ async function transcodeVideo(\n} catch (e) {\nexceptionMessage = getMessageForException(e);\n}\n- if (!success) {\n- unlink(plan.outputPath);\n- }\nreturn {\nstep: 'video_ffmpeg_transcode',\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Add thumbnail generation step to processVideo
Summary: Added thumbnail generation step to `processVideo`
Test Plan: Got path to `thumbnailURI` via `console.log` and made sure the JPG existed/looked correct visually.
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D914 |
129,187 | 29.03.2021 12:44:59 | 14,400 | aafc03e9bc34ce685c1f994586a5a979921c4f11 | [native] Add some comments explaining uploadFile better
Test Plan: N/A
Reviewers: atul, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "native/input/input-state-container.react.js",
"new_path": "native/input/input-state-container.react.js",
"diff": "@@ -546,6 +546,10 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nif (uploadResult) {\nconst { id, mediaType, uri, dimensions, loop } = uploadResult;\nserverID = id;\n+ // When we dispatch this action, it updates Redux and triggers the\n+ // componentDidUpdate in this class. componentDidUpdate will handle\n+ // calling dispatchMultimediaMessageAction once all the uploads are\n+ // complete, and does not wait until this function concludes.\nthis.props.dispatch({\ntype: updateMultimediaMessageMediaActionType,\npayload: {\n@@ -601,7 +605,8 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n// if we have permission. Even if we fail, this temporary file isn't\n// visible to the user, so there's no point in keeping it around. Since\n// the initial URI is used in rendering paths, we have to wait for it to\n- // be replaced with the remote URI before we can dispose\n+ // be replaced with the remote URI before we can dispose. Check out the\n+ // Multimedia component to see how the URIs get switched out.\nconst captureURI = selection.uri;\npromises.push(\n(async () => {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Add some comments explaining uploadFile better
Test Plan: N/A
Reviewers: atul, palys-swm
Reviewed By: atul
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D933 |
129,187 | 29.03.2021 13:16:22 | 14,400 | b584dc433614278dc3a1ce82b0a5a6c8aa884f15 | [native] Update SelectionWithID type to included video thumbnails
Summary: This type is now called `UploadFileInput` to represent its contents a little better.
Test Plan: Flow, will test in combination with future diffs
Reviewers: palys-swm, atul
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "native/input/input-state-container.react.js",
"new_path": "native/input/input-state-container.react.js",
"diff": "@@ -78,9 +78,12 @@ function getNewLocalID() {\nreturn `localUpload${nextLocalUploadID++}`;\n}\n-type SelectionWithID = {|\n+type MediaIDs =\n+ | {| +type: 'photo', +localMediaID: string |}\n+ | {| +type: 'video', +localMediaID: string, +localThumbnailID: string |};\n+type UploadFileInput = {|\n+selection: NativeMediaSelection,\n- +localID: string,\n+ +ids: MediaIDs,\n|};\ntype CompletedUploads = { +[localMessageID: string]: ?Set<string> };\n@@ -364,68 +367,84 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n) => {\nthis.sendCallbacks.forEach((callback) => callback());\nconst localMessageID = `local${this.props.nextLocalID}`;\n- const selectionsWithIDs = selections.map((selection) => ({\n- selection,\n- localID: getNewLocalID(),\n- }));\n-\n- const pendingUploads = {};\n- for (const { localID } of selectionsWithIDs) {\n- pendingUploads[localID] = {\n- failed: null,\n- progressPercent: 0,\n- };\n- }\n- this.setState(\n- (prevState) => {\n- return {\n- pendingUploads: {\n- ...prevState.pendingUploads,\n- [localMessageID]: pendingUploads,\n- },\n- };\n- },\n- () => {\n- const creatorID = this.props.viewerID;\n- invariant(creatorID, 'need viewer ID in order to send a message');\n- const media = selectionsWithIDs.map(({ localID, selection }) => {\n+ const uploadFileInputs = [],\n+ media = [];\n+ for (const selection of selections) {\n+ const localMediaID = getNewLocalID();\n+ let ids;\nif (selection.step === 'photo_library') {\n- return {\n- id: localID,\n+ media.push({\n+ id: localMediaID,\nuri: selection.uri,\ntype: 'photo',\ndimensions: selection.dimensions,\nlocalMediaSelection: selection,\n- };\n+ });\n+ ids = { type: 'photo', localMediaID };\n} else if (selection.step === 'photo_capture') {\n- return {\n- id: localID,\n+ media.push({\n+ id: localMediaID,\nuri: selection.uri,\ntype: 'photo',\ndimensions: selection.dimensions,\nlocalMediaSelection: selection,\n- };\n+ });\n+ ids = { type: 'photo', localMediaID };\n} else if (selection.step === 'photo_paste') {\n- return {\n- id: localID,\n+ media.push({\n+ id: localMediaID,\nuri: selection.uri,\ntype: 'photo',\ndimensions: selection.dimensions,\nlocalMediaSelection: selection,\n- };\n- } else if (selection.step === 'video_library') {\n- return {\n- id: localID,\n+ });\n+ ids = { type: 'photo', localMediaID };\n+ }\n+ const localThumbnailID = getNewLocalID();\n+ if (selection.step === 'video_library') {\n+ media.push({\n+ id: localMediaID,\nuri: selection.uri,\ntype: 'video',\ndimensions: selection.dimensions,\nlocalMediaSelection: selection,\nloop: false,\n+ });\n+ ids = { type: 'video', localMediaID, localThumbnailID };\n+ }\n+ invariant(ids, `unexpected MediaSelection ${selection.step}`);\n+ uploadFileInputs.push({ selection, ids });\n+ }\n+\n+ const pendingUploads = {};\n+ for (const uploadFileInput of uploadFileInputs) {\n+ const { localMediaID } = uploadFileInput.ids;\n+ pendingUploads[localMediaID] = {\n+ failed: null,\n+ progressPercent: 0,\n+ };\n+ if (uploadFileInput.ids.type === 'video') {\n+ const { localThumbnailID } = uploadFileInput.ids;\n+ pendingUploads[localThumbnailID] = {\n+ failed: null,\n+ progressPercent: 0,\n};\n}\n- invariant(false, `invalid selection ${JSON.stringify(selection)}`);\n- });\n+ }\n+\n+ this.setState(\n+ (prevState) => {\n+ return {\n+ pendingUploads: {\n+ ...prevState.pendingUploads,\n+ [localMessageID]: pendingUploads,\n+ },\n+ };\n+ },\n+ () => {\n+ const creatorID = this.props.viewerID;\n+ invariant(creatorID, 'need viewer ID in order to send a message');\nconst messageInfo = createMediaMessageInfo({\nlocalID: localMessageID,\nthreadID,\n@@ -439,16 +458,16 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n},\n);\n- await this.uploadFiles(localMessageID, selectionsWithIDs);\n+ await this.uploadFiles(localMessageID, uploadFileInputs);\n};\nasync uploadFiles(\nlocalMessageID: string,\n- selectionsWithIDs: $ReadOnlyArray<SelectionWithID>,\n+ uploadFileInputs: $ReadOnlyArray<UploadFileInput>,\n) {\nconst results = await Promise.all(\n- selectionsWithIDs.map((selectionWithID) =>\n- this.uploadFile(localMessageID, selectionWithID),\n+ uploadFileInputs.map((uploadFileInput) =>\n+ this.uploadFile(localMessageID, uploadFileInput),\n),\n);\nconst errors = [...new Set(results.filter(Boolean))];\n@@ -459,9 +478,10 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nasync uploadFile(\nlocalMessageID: string,\n- selectionWithID: SelectionWithID,\n+ uploadFileInput: UploadFileInput,\n): Promise<?string> {\n- const { localID, selection } = selectionWithID;\n+ const { ids, selection } = uploadFileInput;\n+ const localID = ids.localMediaID;\nconst start = selection.sendTime;\nconst steps = [selection];\nlet serverID;\n@@ -988,16 +1008,19 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n},\n}));\n- const selectionsWithIDs = retryMedia.map((singleMedia) => {\n+ const uploadFileInputs = retryMedia.map((singleMedia) => {\nconst { id, localMediaSelection } = singleMedia;\ninvariant(\n- localMediaSelection,\n+ localMediaSelection && localMediaSelection.step !== 'video_library',\n'localMediaSelection should be set on locally created Media',\n);\n- return { selection: localMediaSelection, localID: id };\n+ return {\n+ selection: localMediaSelection,\n+ ids: { type: 'photo', localMediaID: id },\n+ };\n});\n- await this.uploadFiles(localMessageID, selectionsWithIDs);\n+ await this.uploadFiles(localMessageID, uploadFileInputs);\n};\nretryMessage = async (localMessageID: string) => {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Update SelectionWithID type to included video thumbnails
Summary: This type is now called `UploadFileInput` to represent its contents a little better.
Test Plan: Flow, will test in combination with future diffs
Reviewers: palys-swm, atul
Reviewed By: atul
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D934 |
129,184 | 31.03.2021 10:10:25 | 14,400 | 548e1176291a6975d8e58a007c46d0fea9a7306b | [lib] minor localUploadID refactor
Summary: Moved getNextLocalUploadID to `lib/media/media-utils` and pulled out `localUploadPrefix`
Test Plan: things work as they did prior, localUploadIDs incrementing as before,etc
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/media/media-utils.js",
"new_path": "lib/media/media-utils.js",
"diff": "@@ -50,8 +50,15 @@ function multimediaMessagePreview(\nreturn `sent ${mediaContentString}`;\n}\n+const localUploadPrefix = 'localUpload';\n+\nfunction isLocalUploadID(id: string): boolean {\n- return id.startsWith('localUpload');\n+ return id.startsWith(localUploadPrefix);\n+}\n+\n+let nextLocalUploadID = 0;\n+function getNextLocalUploadID() {\n+ return `${localUploadPrefix}${nextLocalUploadID++}`;\n}\nexport {\n@@ -60,4 +67,5 @@ export {\ncontentStringForMediaArray,\nmultimediaMessagePreview,\nisLocalUploadID,\n+ getNextLocalUploadID,\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/input/input-state-container.react.js",
"new_path": "native/input/input-state-container.react.js",
"diff": "@@ -22,7 +22,7 @@ import {\ntype MultimediaUploadExtras,\n} from 'lib/actions/upload-actions';\nimport { pathFromURI } from 'lib/media/file-utils';\n-import { isLocalUploadID } from 'lib/media/media-utils';\n+import { isLocalUploadID, getNextLocalUploadID } from 'lib/media/media-utils';\nimport { videoDurationLimit } from 'lib/media/video-utils';\nimport {\ncreateLoadingStatusSelector,\n@@ -74,11 +74,6 @@ import {\ntype MultimediaProcessingStep,\n} from './input-state';\n-let nextLocalUploadID = 0;\n-function getNewLocalID() {\n- return `localUpload${nextLocalUploadID++}`;\n-}\n-\ntype MediaIDs =\n| {| +type: 'photo', +localMediaID: string |}\n| {| +type: 'video', +localMediaID: string, +localThumbnailID: string |};\n@@ -364,7 +359,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nconst uploadFileInputs = [],\nmedia = [];\nfor (const selection of selections) {\n- const localMediaID = getNewLocalID();\n+ const localMediaID = getNextLocalUploadID();\nlet ids;\nif (selection.step === 'photo_library') {\nmedia.push({\n@@ -394,7 +389,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n});\nids = { type: 'photo', localMediaID };\n}\n- const localThumbnailID = getNewLocalID();\n+ const localThumbnailID = getNextLocalUploadID();\nif (selection.step === 'video_library') {\nmedia.push({\nid: localMediaID,\n@@ -897,7 +892,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n// indicates the app has restarted. We'll reassign a new localID to\n// avoid collisions. Note that this isn't necessary for the message ID\n// since the localID reducer prevents collisions there\n- const id = pendingUploads[oldID] ? oldID : getNewLocalID();\n+ const id = pendingUploads[oldID] ? oldID : getNextLocalUploadID();\nconst oldSelection = singleMedia.localMediaSelection;\ninvariant(\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] minor localUploadID refactor
Summary: Moved getNextLocalUploadID to `lib/media/media-utils` and pulled out `localUploadPrefix`
Test Plan: things work as they did prior, localUploadIDs incrementing as before,etc
Reviewers: ashoat, palys-swm
Reviewed By: palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D947 |
129,184 | 31.03.2021 11:55:52 | 14,400 | 948b2c8dedf7070c57e5ea35bf98b2c08e2aecd5 | [native] Modify retryMultimediaMessage to incorporate thumbnails
Summary: Modify retryMultimediaMessage to incorporate thumbnails. Written by Ashoat on Monday.
Test Plan: Will be tested with subsequent diff which actually uploads generated thumbnail
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/types/media-types.js",
"new_path": "lib/types/media-types.js",
"diff": "@@ -25,6 +25,8 @@ export type Video = {|\n+type: 'video',\n+dimensions: Dimensions,\n+loop?: boolean,\n+ +thumbnailID: string,\n+ +thumbnailURI: string,\n// stored on native only during creation in case retry needed after state lost\n+localMediaSelection?: NativeMediaSelection,\n|};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/input/input-state-container.react.js",
"new_path": "native/input/input-state-container.react.js",
"diff": "@@ -398,6 +398,8 @@ class InputStateContainer extends React.PureComponent<Props, State> {\ndimensions: selection.dimensions,\nlocalMediaSelection: selection,\nloop: false,\n+ thumbnailID: localThumbnailID,\n+ thumbnailURI: selection.uri,\n});\nids = { type: 'video', localMediaID, localThumbnailID };\n}\n@@ -411,12 +413,14 @@ class InputStateContainer extends React.PureComponent<Props, State> {\npendingUploads[localMediaID] = {\nfailed: null,\nprogressPercent: 0,\n+ processingStep: null,\n};\nif (uploadFileInput.ids.type === 'video') {\nconst { localThumbnailID } = uploadFileInput.ids;\npendingUploads[localThumbnailID] = {\nfailed: null,\nprogressPercent: 0,\n+ processingStep: null,\n};\n}\n}\n@@ -878,23 +882,62 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nconst updateMedia = <T: Media>(media: $ReadOnlyArray<T>): T[] =>\nmedia.map((singleMedia) => {\n- const oldID = singleMedia.id;\n- if (!isLocalUploadID(oldID)) {\n- // already uploaded\n- return singleMedia;\n- }\n- if (pendingUploads[oldID] && !pendingUploads[oldID].failed) {\n- // still being uploaded\n- return singleMedia;\n- }\n+ let updatedMedia = singleMedia;\n+ const oldMediaID = updatedMedia.id;\n+ if (\n+ // not complete\n+ isLocalUploadID(oldMediaID) &&\n+ // not still ongoing\n+ (!pendingUploads[oldMediaID] || pendingUploads[oldMediaID].failed)\n+ ) {\n// If we have an incomplete upload that isn't in pendingUploads, that\n// indicates the app has restarted. We'll reassign a new localID to\n// avoid collisions. Note that this isn't necessary for the message ID\n// since the localID reducer prevents collisions there\n- const id = pendingUploads[oldID] ? oldID : getNextLocalUploadID();\n+ const mediaID = pendingUploads[oldMediaID]\n+ ? oldMediaID\n+ : getNextLocalUploadID();\n+ if (updatedMedia.type === 'photo') {\n+ updatedMedia = {\n+ type: 'photo',\n+ ...updatedMedia,\n+ id: mediaID,\n+ };\n+ } else {\n+ updatedMedia = {\n+ type: 'video',\n+ ...updatedMedia,\n+ id: mediaID,\n+ };\n+ }\n+ }\n+\n+ if (updatedMedia.type === 'video') {\n+ const oldThumbnailID = updatedMedia.thumbnailID;\n+ invariant(oldThumbnailID, 'oldThumbnailID not null or undefined');\n+ if (\n+ // not complete\n+ isLocalUploadID(oldThumbnailID) &&\n+ // not still ongoing\n+ (!pendingUploads[oldThumbnailID] ||\n+ pendingUploads[oldThumbnailID].failed)\n+ ) {\n+ const thumbnailID = pendingUploads[oldThumbnailID]\n+ ? oldThumbnailID\n+ : getNextLocalUploadID();\n+ updatedMedia = {\n+ ...updatedMedia,\n+ thumbnailID,\n+ };\n+ }\n+ }\n- const oldSelection = singleMedia.localMediaSelection;\n+ if (updatedMedia === singleMedia) {\n+ return singleMedia;\n+ }\n+\n+ const oldSelection = updatedMedia.localMediaSelection;\ninvariant(\noldSelection,\n'localMediaSelection should be set on locally created Media',\n@@ -913,18 +956,16 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nselection = { ...oldSelection, sendTime: now, retries };\n}\n- if (singleMedia.type === 'photo') {\n+ if (updatedMedia.type === 'photo') {\nreturn {\ntype: 'photo',\n- ...singleMedia,\n- id,\n+ ...updatedMedia,\nlocalMediaSelection: selection,\n};\n} else {\nreturn {\ntype: 'video',\n- ...singleMedia,\n- id,\n+ ...updatedMedia,\nlocalMediaSelection: selection,\n};\n}\n@@ -982,12 +1023,21 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n// We clear out the failed status on individual media here,\n// which makes the UI show pending status instead of error messages\n- for (const { id } of retryMedia) {\n- pendingUploads[id] = {\n+ for (const singleMedia of retryMedia) {\n+ pendingUploads[singleMedia.id] = {\nfailed: null,\nprogressPercent: 0,\nprocessingStep: null,\n};\n+ if (singleMedia.type === 'video') {\n+ const { thumbnailID } = singleMedia;\n+ invariant(thumbnailID, 'thumbnailID not null or undefined');\n+ pendingUploads[thumbnailID] = {\n+ failed: null,\n+ progressPercent: 0,\n+ processingStep: null,\n+ };\n+ }\n}\nthis.setState((prevState) => ({\npendingUploads: {\n@@ -997,14 +1047,29 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n}));\nconst uploadFileInputs = retryMedia.map((singleMedia) => {\n- const { id, localMediaSelection } = singleMedia;\ninvariant(\n- localMediaSelection && localMediaSelection.step !== 'video_library',\n+ singleMedia.localMediaSelection,\n'localMediaSelection should be set on locally created Media',\n);\n+\n+ let ids;\n+ if (singleMedia.type === 'photo') {\n+ ids = { type: 'photo', localMediaID: singleMedia.id };\n+ } else {\n+ invariant(\n+ singleMedia.thumbnailID,\n+ 'singleMedia.thumbnailID should be set for videos',\n+ );\n+ ids = {\n+ type: 'video',\n+ localMediaID: singleMedia.id,\n+ localThumbnailID: singleMedia.thumbnailID,\n+ };\n+ }\n+\nreturn {\n- selection: localMediaSelection,\n- ids: { type: 'photo', localMediaID: id },\n+ selection: singleMedia.localMediaSelection,\n+ ids,\n};\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/fetchers/upload-fetchers.js",
"new_path": "server/src/fetchers/upload-fetchers.js",
"diff": "@@ -89,8 +89,10 @@ function mediaFromRow(row: Object): Media {\nif (type === 'photo') {\nreturn { id, type: 'photo', uri, dimensions };\n} else if (loop) {\n+ // $FlowFixMe add thumbnailID, thumbnailURI once they're in DB\nreturn { id, type: 'video', uri, dimensions, loop };\n} else {\n+ // $FlowFixMe add thumbnailID, thumbnailURI once they're in DB\nreturn { id, type: 'video', uri, dimensions };\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/input/input-state-container.react.js",
"new_path": "web/input/input-state-container.react.js",
"diff": "@@ -177,7 +177,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nconst creatorID = this.props.viewerID;\ninvariant(creatorID, 'need viewer ID in order to send a message');\nconst media = uploads.map(\n- ({ localID, serverID, uri, mediaType, dimensions, loop }) => {\n+ ({ localID, serverID, uri, mediaType, dimensions }) => {\n// We can get into this state where dimensions are null if the user is\n// uploading a file type that the browser can't render. In that case\n// we fake the dimensions here while we wait for the server to tell us\n@@ -188,22 +188,16 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nconst shimmedDimensions = dimensions\n? dimensions\n: { height: 0, width: 0 };\n- if (mediaType === 'photo') {\n+ invariant(\n+ mediaType === 'photo',\n+ \"web InputStateContainer can't handle video\",\n+ );\nreturn {\nid: serverID ? serverID : localID,\nuri,\ntype: 'photo',\ndimensions: shimmedDimensions,\n};\n- } else {\n- return {\n- id: serverID ? serverID : localID,\n- uri,\n- type: 'video',\n- dimensions: shimmedDimensions,\n- loop,\n- };\n- }\n},\n);\nconst messageInfo = createMediaMessageInfo({\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Modify retryMultimediaMessage to incorporate thumbnails
Summary: Modify retryMultimediaMessage to incorporate thumbnails. Written by Ashoat on Monday.
Test Plan: Will be tested with subsequent diff which actually uploads generated thumbnail
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D948 |
129,184 | 31.03.2021 13:33:34 | 14,400 | 8c22947fb36953bf070f06437d9aca8f1e657dea | [native] Pass uploadThumbnailURI to input-state-container:uploadFile
Summary: Passing uploadThumbnailURI to `uploadFile` and unlinking it there (temporarily). Changes to `MediaResult` in `native/media/media-utils` to resolve flow issues.
Test Plan: Will be tested in subsequent diffs
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "native/input/input-state-container.react.js",
"new_path": "native/input/input-state-container.react.js",
"diff": "@@ -535,9 +535,11 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nconst uploadStart = Date.now();\nlet uploadExceptionMessage, uploadResult, mediaMissionResult;\ntry {\n+ const loop =\n+ processedMedia.mediaType === 'video' ? processedMedia.loop : undefined;\nuploadResult = await this.props.uploadMultimedia(\n{ uri: uploadURI, name: filename, type: mime },\n- { ...processedMedia.dimensions, loop: processedMedia.loop },\n+ { ...processedMedia.dimensions, loop },\n{\nonProgress: (percent: number) =>\nthis.setProgress(\n@@ -561,7 +563,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n}\nif (uploadResult) {\n- const { id, mediaType, uri, dimensions, loop } = uploadResult;\n+ const { id, uri, dimensions, loop } = uploadResult;\nserverID = id;\n// When we dispatch this action, it updates Redux and triggers the\n// componentDidUpdate in this class. componentDidUpdate will handle\n@@ -574,7 +576,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\ncurrentMediaID: localMediaID,\nmediaUpdate: {\nid,\n- type: mediaType,\n+ type: uploadResult.mediaType,\nuri,\ndimensions,\nlocalMediaSelection: undefined,\n@@ -616,6 +618,18 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n);\n}\n+ // if there's a thumbnail we'll temporarily unlink it here\n+ // instead of in media-utils, will be changed in later diffs\n+ if (processedMedia.mediaType === 'video') {\n+ const { uploadThumbnailURI } = processedMedia;\n+ promises.push(\n+ (async () => {\n+ const disposeStep = await disposeTempFile(uploadThumbnailURI);\n+ steps.push(disposeStep);\n+ })(),\n+ );\n+ }\n+\nif (selection.captureTime || selection.step === 'photo_paste') {\n// If we are uploading a newly captured photo, we dispose of the original\n// file here. Note that we try to save photo captures to the camera roll\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/media-utils.js",
"new_path": "native/media/media-utils.js",
"diff": "import invariant from 'invariant';\nimport { Image } from 'react-native';\n-import { unlink } from 'react-native-fs';\nimport { pathFromURI, readableFilename } from 'lib/media/file-utils';\nimport type {\nDimensions,\n- MediaType,\nMediaMissionStep,\nMediaMissionFailure,\nNativeMediaSelection,\n@@ -24,15 +22,20 @@ type MediaProcessConfig = {|\n+finalFileHeaderCheck?: boolean,\n+onTranscodingProgress: (percent: number) => void,\n|};\n-type MediaResult = {|\n+type SharedMediaResult = {|\n+success: true,\n+uploadURI: string,\n- +thumbnailURI: ?string,\n+shouldDisposePath: ?string,\n+filename: string,\n+mime: string,\n- +mediaType: MediaType,\n+dimensions: Dimensions,\n+|};\n+type MediaResult =\n+ | {| +mediaType: 'photo', ...SharedMediaResult |}\n+ | {|\n+ +mediaType: 'video',\n+ ...SharedMediaResult,\n+ +uploadThumbnailURI: string,\n+loop: boolean,\n|};\nfunction processMedia(\n@@ -64,7 +67,7 @@ async function innerProcessMedia(\n): Promise<$ReadOnlyArray<MediaMissionStep>> {\nlet initialURI = null,\nuploadURI = null,\n- thumbnailURI = null,\n+ uploadThumbnailURI = null,\ndimensions = selection.dimensions,\nmediaType = null,\nmime = null,\n@@ -88,10 +91,12 @@ async function innerProcessMedia(\ninitialURI !== uploadURI ? pathFromURI(uploadURI) : null;\nconst filename = readableFilename(selection.filename, mime);\ninvariant(filename, `could not construct filename for ${mime}`);\n+ if (mediaType === 'video') {\n+ invariant(uploadThumbnailURI, 'video should have uploadThumbnailURI');\nsendResult({\nsuccess: true,\nuploadURI,\n- thumbnailURI,\n+ uploadThumbnailURI,\nshouldDisposePath,\nfilename,\nmime,\n@@ -99,6 +104,17 @@ async function innerProcessMedia(\ndimensions,\nloop,\n});\n+ } else {\n+ sendResult({\n+ success: true,\n+ uploadURI,\n+ shouldDisposePath,\n+ filename,\n+ mime,\n+ mediaType,\n+ dimensions,\n+ });\n+ }\n};\nconst steps = [],\n@@ -171,10 +187,13 @@ async function innerProcessMedia(\nif (!videoResult.success) {\nreturn await finish(videoResult);\n}\n- ({ uri: uploadURI, thumbnailURI, mime, dimensions, loop } = videoResult);\n- // unlink the thumbnailURI so we don't clog up temp dir\n- // we use thumbnailURI in subsequent diffs\n- unlink(thumbnailURI);\n+ ({\n+ uri: uploadURI,\n+ thumbnailURI: uploadThumbnailURI,\n+ mime,\n+ dimensions,\n+ loop,\n+ } = videoResult);\n} else if (mediaType === 'photo') {\nconst { steps: imageSteps, result: imageResult } = await processImage({\nuri: initialURI,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Pass uploadThumbnailURI to input-state-container:uploadFile
Summary: Passing uploadThumbnailURI to `uploadFile` and unlinking it there (temporarily). Changes to `MediaResult` in `native/media/media-utils` to resolve flow issues.
Test Plan: Will be tested in subsequent diffs
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D950 |
129,187 | 30.03.2021 11:40:40 | 14,400 | 433e7c939780edcbb286a50d04fb77c507ac3838 | [web] Introduce nav reducer
Summary: This should be a pure refactor to introduce a new `reduceNavInfo` function on web.
Test Plan: Flow
Reviewers: KatPo, palys-swm
Subscribers: zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "web/app.react.js",
"new_path": "web/app.react.js",
"diff": "@@ -40,13 +40,13 @@ import LoadingIndicator from './loading-indicator.react';\nimport ResetPasswordModal from './modals/account/reset-password-modal.react';\nimport VerificationModal from './modals/account/verification-modal.react';\nimport FocusHandler from './redux/focus-handler.react';\n-import { type NavInfo, updateNavInfoActionType } from './redux/redux-setup';\nimport { useSelector } from './redux/redux-utils';\nimport VisibilityHandler from './redux/visibility-handler.react';\nimport history from './router-history';\nimport Splash from './splash/splash.react';\nimport css from './style.css';\nimport getTitle from './title/getTitle';\n+import { type NavInfo, updateNavInfoActionType } from './types/nav-types';\nimport { canonicalURLFromReduxState, navInfoFromURL } from './url-utils';\n// We want Webpack's css-loader and style-loader to handle the Fontawesome CSS,\n"
},
{
"change_type": "MODIFY",
"old_path": "web/calendar/calendar.react.js",
"new_path": "web/calendar/calendar.react.js",
"diff": "@@ -30,13 +30,13 @@ import {\nendDateForYearAndMonth,\n} from 'lib/utils/date-utils';\n-import { type NavInfo } from '../redux/redux-setup';\nimport { useSelector } from '../redux/redux-utils';\nimport {\nyearAssertingSelector,\nmonthAssertingSelector,\nwebCalendarQuery,\n} from '../selectors/nav-selectors';\n+import type { NavInfo } from '../types/nav-types';\nimport { canonicalURLFromReduxState } from '../url-utils';\nimport css from './calendar.css';\nimport Day from './day.react';\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/robotext-message.react.js",
"new_path": "web/chat/robotext-message.react.js",
"diff": "@@ -13,8 +13,8 @@ import { type ThreadInfo } from 'lib/types/thread-types';\nimport Markdown from '../markdown/markdown.react';\nimport { linkRules } from '../markdown/rules.react';\n-import { updateNavInfoActionType } from '../redux/redux-setup';\nimport { useSelector } from '../redux/redux-utils';\n+import { updateNavInfoActionType } from '../types/nav-types';\nimport css from './chat-message-list.css';\nimport { InlineSidebar } from './inline-sidebar.react';\nimport type {\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/redux/nav-reducer.js",
"diff": "+// @flow\n+\n+import type { Action } from '../redux/redux-setup';\n+import { type NavInfo, updateNavInfoActionType } from '../types/nav-types';\n+\n+export default function reduceNavInfo(state: NavInfo, action: Action): NavInfo {\n+ if (action.type === updateNavInfoActionType) {\n+ return {\n+ ...state,\n+ ...action.payload,\n+ };\n+ }\n+ return state;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/redux/redux-setup.js",
"new_path": "web/redux/redux-setup.js",
"diff": "@@ -15,28 +15,20 @@ import type { CalendarFilter } from 'lib/types/filter-types';\nimport type { LifecycleState } from 'lib/types/lifecycle-state-types';\nimport type { LoadingStatus } from 'lib/types/loading-types';\nimport type { MessageStore } from 'lib/types/message-types';\n-import type { BaseNavInfo } from 'lib/types/nav-types';\nimport type { BaseAction } from 'lib/types/redux-types';\nimport type { ClientReportCreationRequest } from 'lib/types/report-types';\nimport type { ConnectionInfo } from 'lib/types/socket-types';\n-import type { ThreadInfo, ThreadStore } from 'lib/types/thread-types';\n+import type { ThreadStore } from 'lib/types/thread-types';\nimport type { CurrentUserInfo, UserStore } from 'lib/types/user-types';\nimport type { ServerVerificationResult } from 'lib/types/verify-types';\nimport { setNewSessionActionType } from 'lib/utils/action-utils';\nimport { activeThreadSelector } from '../selectors/nav-selectors';\n+import { type NavInfo, updateNavInfoActionType } from '../types/nav-types';\nimport { updateWindowActiveActionType } from './action-types';\n+import reduceNavInfo from './nav-reducer';\nimport { getVisibility } from './visibility';\n-export type NavInfo = {|\n- ...$Exact<BaseNavInfo>,\n- +tab: 'calendar' | 'chat',\n- +verify: ?string,\n- +activeChatThreadID: ?string,\n- +pendingThread?: ThreadInfo,\n- +sourceMessageID?: string,\n-|};\n-\nexport type WindowDimensions = {| width: number, height: number |};\nexport type AppState = {|\nnavInfo: NavInfo,\n@@ -66,7 +58,6 @@ export type AppState = {|\nwindowActive: boolean,\n|};\n-export const updateNavInfoActionType = 'UPDATE_NAV_INFO';\nexport const updateWindowDimensions = 'UPDATE_WINDOW_DIMENSIONS';\nexport type Action =\n@@ -85,15 +76,7 @@ export function reducer(oldState: AppState | void, action: Action) {\ninvariant(oldState, 'should be set');\nlet state = oldState;\n- if (action.type === updateNavInfoActionType) {\n- return validateState(oldState, {\n- ...state,\n- navInfo: {\n- ...state.navInfo,\n- ...action.payload,\n- },\n- });\n- } else if (action.type === updateWindowDimensions) {\n+ if (action.type === updateWindowDimensions) {\nreturn validateState(oldState, {\n...state,\nwindowDimensions: action.payload,\n@@ -134,7 +117,16 @@ export function reducer(oldState: AppState | void, action: Action) {\nreturn oldState;\n}\n- return validateState(oldState, baseReducer(state, action));\n+ if (action.type !== updateNavInfoActionType) {\n+ state = baseReducer(state, action);\n+ }\n+\n+ state = {\n+ ...state,\n+ navInfo: reduceNavInfo(state.navInfo, action),\n+ };\n+\n+ return validateState(oldState, state);\n}\nfunction validateState(oldState: AppState, state: AppState): AppState {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/selectors/nav-selectors.js",
"new_path": "web/selectors/nav-selectors.js",
"diff": "@@ -18,8 +18,8 @@ import type { ThreadInfo } from 'lib/types/thread-types';\nimport { getDefaultTextMessageRules } from '../markdown/rules.react';\nimport type { AppState } from '../redux/redux-setup';\n-import { updateNavInfoActionType } from '../redux/redux-setup';\nimport { useSelector } from '../redux/redux-utils';\n+import { updateNavInfoActionType } from '../types/nav-types';\nconst dateExtractionRegex = /^([0-9]{4})-([0-9]{2})-[0-9]{2}$/;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "web/types/nav-types.js",
"diff": "+// @flow\n+\n+import type { BaseNavInfo } from 'lib/types/nav-types';\n+import type { ThreadInfo } from 'lib/types/thread-types';\n+\n+export type NavInfo = {|\n+ ...$Exact<BaseNavInfo>,\n+ +tab: 'calendar' | 'chat',\n+ +verify: ?string,\n+ +activeChatThreadID: ?string,\n+ +pendingThread?: ThreadInfo,\n+ +sourceMessageID?: string,\n+|};\n+\n+export const updateNavInfoActionType = 'UPDATE_NAV_INFO';\n"
},
{
"change_type": "MODIFY",
"old_path": "web/url-utils.js",
"new_path": "web/url-utils.js",
"diff": "@@ -8,8 +8,8 @@ import {\n} from 'lib/utils/date-utils';\nimport { infoFromURL } from 'lib/utils/url-utils';\n-import type { NavInfo } from './redux/redux-setup';\nimport { yearExtractor, monthExtractor } from './selectors/nav-selectors';\n+import type { NavInfo } from './types/nav-types';\nfunction canonicalURLFromReduxState(\nnavInfo: NavInfo,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Introduce nav reducer
Summary: This should be a pure refactor to introduce a new `reduceNavInfo` function on web.
Test Plan: Flow
Reviewers: KatPo, palys-swm
Reviewed By: KatPo, palys-swm
Subscribers: zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D941 |
129,184 | 31.03.2021 16:27:06 | 14,400 | 3f928f6449fb5d8e8bd274354341782a85315607 | [web] use `getNextLocalUploadID` in web/inputStateContainer
Summary: Addressing
Test Plan: careful reading
Reviewers: ashoat, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "web/input/input-state-container.react.js",
"new_path": "web/input/input-state-container.react.js",
"diff": "@@ -27,6 +27,7 @@ import {\ntype MultimediaUploadCallbacks,\ntype MultimediaUploadExtras,\n} from 'lib/actions/upload-actions';\n+import { getNextLocalUploadID } from 'lib/media/media-utils';\nimport { createMediaMessageInfo } from 'lib/shared/message-utils';\nimport type {\nUploadMultimediaResult,\n@@ -60,8 +61,6 @@ import InvalidUploadModal from '../modals/chat/invalid-upload.react';\nimport { useSelector } from '../redux/redux-utils';\nimport { type PendingMultimediaUpload, InputStateContext } from './input-state';\n-let nextLocalUploadID = 0;\n-\ntype BaseProps = {|\n+children: React.Node,\n+setModal: (modal: ?React.Node) => void,\n@@ -466,7 +465,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nresult: {\nsuccess: true,\npendingUpload: {\n- localID: `localUpload${nextLocalUploadID++}`,\n+ localID: getNextLocalUploadID(),\nserverID: null,\nmessageID: null,\nfailed: null,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] use `getNextLocalUploadID` in web/inputStateContainer
Summary: Addressing https://phabricator.ashoat.com/D947#22346
Test Plan: careful reading
Reviewers: ashoat, palys-swm
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D951 |
129,187 | 31.03.2021 20:42:43 | 14,400 | 72385a2e49b5da1febfa9e3dff1c5c7272d1ee93 | [server] Prevent threads from being converted to SIDEBARs
Summary: If you're not born a `SIDEBAR`, you can't become one.
Test Plan: careful reading
Reviewers: palys-swm, KatPo
Subscribers: zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/thread-updaters.js",
"new_path": "server/src/updaters/thread-updaters.js",
"diff": "@@ -343,7 +343,9 @@ async function updateThread(\nif (\n!viewer.isScriptViewer &&\n- (threadType === threadTypes.PERSONAL || threadType === threadTypes.PRIVATE)\n+ (threadType === threadTypes.PERSONAL ||\n+ threadType === threadTypes.PRIVATE ||\n+ threadType === threadTypes.SIDEBAR)\n) {\nthrow new ServerError('invalid_parameters');\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Prevent threads from being converted to SIDEBARs
Summary: If you're not born a `SIDEBAR`, you can't become one.
Test Plan: careful reading
Reviewers: palys-swm, KatPo
Reviewed By: palys-swm, KatPo
Subscribers: zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D952 |
129,187 | 31.03.2021 20:52:13 | 14,400 | 7ca77320fcf8105ab5ab27ec5b0ec54be65a0c8c | [server] Prevent changing SIDEBAR parentThreadID
Test Plan: careful reading
Reviewers: palys-swm, KatPo
Subscribers: zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/thread-updaters.js",
"new_path": "server/src/updaters/thread-updaters.js",
"diff": "@@ -425,6 +425,11 @@ async function updateThread(\nlet nextParentThreadID =\nparentThreadID !== undefined ? parentThreadID : oldParentThreadID;\n+ // You can't change the parent thread of a SIDEBAR\n+ if (nextThreadType === threadTypes.SIDEBAR && parentThreadID !== undefined) {\n+ throw new ServerError('invalid_parameters');\n+ }\n+\n// Does the new thread type preclude a parent?\nif (\nthreadType !== undefined &&\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Prevent changing SIDEBAR parentThreadID
Test Plan: careful reading
Reviewers: palys-swm, KatPo
Reviewed By: palys-swm, KatPo
Subscribers: zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D953 |
129,187 | 31.03.2021 20:55:44 | 14,400 | c54604590a8d0f8deb4feb332a008cc9d0fbe5b7 | [server] recalculateAllPermissions -> recalculateThreadPermissions
Summary: This is a simple rename. The old name was ambiguous with the other function `recalculateAllThreadPermissions`.
Test Plan: Flow
Reviewers: palys-swm, KatPo
Subscribers: zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "server/src/creators/thread-creator.js",
"new_path": "server/src/creators/thread-creator.js",
"diff": "@@ -30,7 +30,7 @@ import { fetchKnownUserInfos } from '../fetchers/user-fetchers';\nimport type { Viewer } from '../session/viewer';\nimport {\nchangeRole,\n- recalculateAllPermissions,\n+ recalculateThreadPermissions,\ncommitMembershipChangeset,\nsetJoinsToUnread,\ngetRelationshipRowsForUsers,\n@@ -327,7 +327,7 @@ async function createThread(\nchangeRole(id, [viewer.userID], newRoles.creator.id),\ninitialMemberIDs ? changeRole(id, initialMemberIDs, null) : undefined,\nghostMemberIDs ? changeRole(id, ghostMemberIDs, -1) : undefined,\n- recalculateAllPermissions(id, threadType),\n+ recalculateThreadPermissions(id, threadType),\n]);\nif (!creatorChangeset) {\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/role-updaters.js",
"new_path": "server/src/updaters/role-updaters.js",
"diff": "@@ -15,7 +15,7 @@ import { fetchRoles } from '../fetchers/role-fetchers';\nimport type { Viewer } from '../session/viewer';\nimport {\ncommitMembershipChangeset,\n- recalculateAllPermissions,\n+ recalculateThreadPermissions,\n} from './thread-permission-updaters';\nasync function updateRoles(\n@@ -126,7 +126,7 @@ async function DEPRECATED_updateRoleAndPermissions(\n`;\nawait dbQuery(updatePermissions);\n- const changeset = await recalculateAllPermissions(threadID, threadType);\n+ const changeset = await recalculateThreadPermissions(threadID, threadType);\nreturn await commitMembershipChangeset(viewer, changeset);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/thread-permission-updaters.js",
"new_path": "server/src/updaters/thread-permission-updaters.js",
"diff": "@@ -388,7 +388,7 @@ async function updateDescendantPermissions(\nreturn { membershipRows, relationshipRows };\n}\n-async function recalculateAllPermissions(\n+async function recalculateThreadPermissions(\nthreadID: string,\nthreadType: ThreadType,\n): Promise<Changeset> {\n@@ -814,23 +814,23 @@ async function recalculateAllThreadPermissions() {\n// We handle each thread one-by-one to avoid a situation where a permission\n// calculation for a child thread, done during a call to\n- // recalculateAllPermissions for the parent thread, can be incorrectly\n- // overriden by a call to recalculateAllPermissions for the child thread. If\n- // the changeset resulting from the parent call isn't committed before the\n+ // recalculateThreadPermissions for the parent thread, can be incorrectly\n+ // overriden by a call to recalculateThreadPermissions for the child thread.\n+ // If the changeset resulting from the parent call isn't committed before the\n// calculation is done for the child, the calculation done for the child can\n// be incorrect.\nconst viewer = createScriptViewer(bots.squadbot.userID);\nfor (const row of result) {\nconst threadID = row.id.toString();\nconst threadType = assertThreadType(row.type);\n- const changeset = await recalculateAllPermissions(threadID, threadType);\n+ const changeset = await recalculateThreadPermissions(threadID, threadType);\nawait commitMembershipChangeset(viewer, changeset);\n}\n}\nexport {\nchangeRole,\n- recalculateAllPermissions,\n+ recalculateThreadPermissions,\nsaveMemberships,\ncommitMembershipChangeset,\nsetJoinsToUnread,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/thread-updaters.js",
"new_path": "server/src/updaters/thread-updaters.js",
"diff": "@@ -54,7 +54,7 @@ import type { Viewer } from '../session/viewer';\nimport { updateRoles } from './role-updaters';\nimport {\nchangeRole,\n- recalculateAllPermissions,\n+ recalculateThreadPermissions,\ncommitMembershipChangeset,\nsetJoinsToUnread,\ngetParentThreadRelationshipRowsForNewUsers,\n@@ -528,7 +528,10 @@ async function updateThread(\nif (forceUpdateRoot || nextThreadType !== oldThreadType) {\nawait updateRoles(viewer, request.threadID, nextThreadType);\n}\n- return await recalculateAllPermissions(request.threadID, nextThreadType);\n+ return await recalculateThreadPermissions(\n+ request.threadID,\n+ nextThreadType,\n+ );\n})();\n}\nconst {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] recalculateAllPermissions -> recalculateThreadPermissions
Summary: This is a simple rename. The old name was ambiguous with the other function `recalculateAllThreadPermissions`.
Test Plan: Flow
Reviewers: palys-swm, KatPo
Reviewed By: palys-swm, KatPo
Subscribers: zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D954 |
129,187 | 05.04.2021 12:45:28 | 14,400 | 7e704d746eef7ceb9c4cdfc3ff5f0215a938338e | Factor out shared webpack config into lib/webpack/shared.cjs
Summary: We're going to use this in the upcoming `landing` project.
Test Plan: Make sure Webpack still builds and server still returns a working webpage on both dev and prod
Reviewers: atul, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "lib/webpack/shared.cjs",
"diff": "+const webpack = require('webpack');\n+const path = require('path');\n+const MiniCssExtractPlugin = require('mini-css-extract-plugin');\n+const TerserPlugin = require('terser-webpack-plugin');\n+const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');\n+const { CleanWebpackPlugin } = require('clean-webpack-plugin');\n+\n+const sharedPlugins = [\n+ new webpack.optimize.LimitChunkCountPlugin({\n+ maxChunks: 1,\n+ }),\n+];\n+\n+const cssLoader = {\n+ loader: 'css-loader',\n+ options: {\n+ modules: {\n+ mode: 'local',\n+ localIdentName: '[path][name]__[local]--[hash:base64:5]',\n+ },\n+ },\n+};\n+const cssExtractLoader = {\n+ loader: MiniCssExtractPlugin.loader,\n+ options: {\n+ esModule: true,\n+ },\n+};\n+const styleLoader = {\n+ loader: 'style-loader',\n+ options: {\n+ esModule: true,\n+ },\n+};\n+\n+function getBabelRule(babelConfig) {\n+ return {\n+ test: /\\.js$/,\n+ exclude: /node_modules\\/(?!lib)/,\n+ loader: 'babel-loader',\n+ options: babelConfig,\n+ };\n+}\n+function getBrowserBabelRule(babelConfig) {\n+ const babelRule = getBabelRule(babelConfig);\n+ return {\n+ ...babelRule,\n+ options: {\n+ ...babelRule.options,\n+ presets: [\n+ ...babelRule.options.presets,\n+ [\n+ '@babel/preset-env',\n+ {\n+ targets: 'defaults',\n+ useBuiltIns: 'usage',\n+ corejs: '3.6',\n+ },\n+ ],\n+ ],\n+ },\n+ };\n+}\n+\n+const imageRule = {\n+ test: /\\.png$/,\n+ use: ['url-loader'],\n+};\n+\n+function createBaseBrowserConfig(baseConfig) {\n+ return {\n+ ...baseConfig,\n+ name: 'browser',\n+ optimization: {\n+ minimizer: [new TerserPlugin(), new OptimizeCssAssetsPlugin()],\n+ },\n+ plugins: [\n+ ...(baseConfig.plugins ?? []),\n+ ...sharedPlugins,\n+ new CleanWebpackPlugin({\n+ cleanOnceBeforeBuildPatterns: [],\n+ }),\n+ ],\n+ };\n+}\n+\n+function createProdBrowserConfig(baseConfig, babelConfig) {\n+ const browserConfig = createBaseBrowserConfig(baseConfig);\n+ const babelRule = getBrowserBabelRule(babelConfig);\n+ return {\n+ ...browserConfig,\n+ mode: 'production',\n+ plugins: [\n+ ...browserConfig.plugins,\n+ new webpack.DefinePlugin({\n+ 'process.env': {\n+ NODE_ENV: JSON.stringify('production'),\n+ BROWSER: true,\n+ },\n+ }),\n+ new MiniCssExtractPlugin({\n+ filename: 'prod.[contenthash:12].build.css',\n+ }),\n+ ],\n+ module: {\n+ rules: [\n+ {\n+ ...babelRule,\n+ options: {\n+ ...babelRule.options,\n+ plugins: [\n+ ...babelRule.options.plugins,\n+ '@babel/plugin-transform-react-constant-elements',\n+ 'transform-remove-console',\n+ ],\n+ },\n+ },\n+ {\n+ test: /\\.css$/,\n+ exclude: /node_modules\\/.*\\.css$/,\n+ use: [\n+ cssExtractLoader,\n+ {\n+ ...cssLoader,\n+ options: {\n+ ...cssLoader.options,\n+ url: false,\n+ },\n+ },\n+ ],\n+ },\n+ {\n+ test: /node_modules\\/.*\\.css$/,\n+ use: [\n+ cssExtractLoader,\n+ {\n+ ...cssLoader,\n+ options: {\n+ ...cssLoader.options,\n+ url: false,\n+ modules: false,\n+ },\n+ },\n+ ],\n+ },\n+ ],\n+ },\n+ };\n+}\n+\n+function createDevBrowserConfig(baseConfig, babelConfig) {\n+ const browserConfig = createBaseBrowserConfig(baseConfig);\n+ const babelRule = getBrowserBabelRule(babelConfig);\n+ return {\n+ ...browserConfig,\n+ entry: {\n+ ...browserConfig.entry,\n+ browser: ['react-hot-loader/patch', ...browserConfig.entry.browser],\n+ },\n+ mode: 'development',\n+ plugins: [\n+ ...browserConfig.plugins,\n+ new webpack.DefinePlugin({\n+ 'process.env': {\n+ NODE_ENV: JSON.stringify('dev'),\n+ BROWSER: true,\n+ },\n+ }),\n+ ],\n+ module: {\n+ rules: [\n+ {\n+ ...babelRule,\n+ options: {\n+ ...babelRule.options,\n+ plugins: [\n+ 'react-hot-loader/babel',\n+ ...babelRule.options.plugins,\n+ ],\n+ },\n+ },\n+ imageRule,\n+ {\n+ test: /\\.css$/,\n+ exclude: /node_modules\\/.*\\.css$/,\n+ use: [styleLoader, cssLoader],\n+ },\n+ {\n+ test: /node_modules\\/.*\\.css$/,\n+ use: [\n+ styleLoader,\n+ {\n+ ...cssLoader,\n+ options: {\n+ ...cssLoader.options,\n+ modules: false,\n+ },\n+ },\n+ ],\n+ },\n+ ],\n+ },\n+ devtool: 'eval-cheap-module-source-map',\n+ resolve: {\n+ ...browserConfig.resolve,\n+ alias: {\n+ ...browserConfig.resolve.alias,\n+ 'react-dom': '@hot-loader/react-dom',\n+ },\n+ },\n+ };\n+}\n+\n+function createNodeServerRenderingConfig(baseConfig, babelConfig) {\n+ return {\n+ ...baseConfig,\n+ name: 'server',\n+ target: 'node',\n+ module: {\n+ rules: [\n+ getBabelRule(babelConfig),\n+ {\n+ test: /\\.css$/,\n+ use: {\n+ ...cssLoader,\n+ options: {\n+ ...cssLoader.options,\n+ modules: {\n+ ...cssLoader.options.modules,\n+ exportOnlyLocals: true,\n+ },\n+ },\n+ },\n+ },\n+ ],\n+ },\n+ plugins: sharedPlugins,\n+ };\n+}\n+\n+module.exports = {\n+ createProdBrowserConfig,\n+ createDevBrowserConfig,\n+ createNodeServerRenderingConfig,\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "web/webpack.config.cjs",
"new_path": "web/webpack.config.cjs",
"diff": "-const webpack = require('webpack');\nconst path = require('path');\n-const MiniCssExtractPlugin = require('mini-css-extract-plugin');\nconst AssetsPlugin = require('assets-webpack-plugin');\n-const TerserPlugin = require('terser-webpack-plugin');\n-const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');\n-const { CleanWebpackPlugin } = require('clean-webpack-plugin');\nconst babelConfig = require('./babel.config.cjs');\n-\n-const sharedPlugins = [\n- new webpack.optimize.LimitChunkCountPlugin({\n- maxChunks: 1,\n- }),\n-];\n-\n-const cssLoader = {\n- loader: 'css-loader',\n- options: {\n- modules: {\n- mode: 'local',\n- localIdentName: '[path][name]__[local]--[hash:base64:5]',\n- },\n- },\n-};\n-const cssExtractLoader = {\n- loader: MiniCssExtractPlugin.loader,\n- options: {\n- esModule: true,\n- },\n-};\n-const styleLoader = {\n- loader: 'style-loader',\n- options: {\n- esModule: true,\n- },\n-};\n-\n-const babelRule = {\n- test: /\\.js$/,\n- exclude: /node_modules\\/(?!lib)/,\n- loader: 'babel-loader',\n- options: babelConfig,\n-};\n-const browserBabelRule = {\n- ...babelRule,\n- options: {\n- ...babelRule.options,\n- presets: [\n- ...babelRule.options.presets,\n- [\n- '@babel/preset-env',\n- {\n- targets: 'defaults',\n- useBuiltIns: 'usage',\n- corejs: '3.6',\n- },\n- ],\n- ],\n- },\n-};\n-\n-const imageRule = {\n- test: /\\.png$/,\n- use: ['url-loader'],\n-};\n+const {\n+ createProdBrowserConfig,\n+ createDevBrowserConfig,\n+ createNodeServerRenderingConfig,\n+} = require('lib/webpack/shared.cjs');\nconst baseBrowserConfig = {\n- name: 'browser',\nentry: {\nbrowser: ['./script.js'],\n},\n@@ -79,163 +21,36 @@ const baseBrowserConfig = {\n'../images': path.resolve('../server/images'),\n},\n},\n- optimization: {\n- minimizer: [new TerserPlugin(), new OptimizeCssAssetsPlugin()],\n- },\n- plugins: [\n- ...sharedPlugins,\n- new CleanWebpackPlugin({\n- cleanOnceBeforeBuildPatterns: [],\n- }),\n- ],\n};\n-module.exports = function (env) {\n- if (env !== 'prod' && env !== 'dev') {\n- env = 'dev';\n- }\n- let browserConfig = baseBrowserConfig;\n- if (env === 'dev') {\n- browserConfig = {\n- ...browserConfig,\n- entry: {\n- ...browserConfig.entry,\n- browser: ['react-hot-loader/patch', ...browserConfig.entry.browser],\n- },\n- mode: 'development',\n+const baseDevBrowserConfig = {\n+ ...baseBrowserConfig,\noutput: {\n- ...browserConfig.output,\n+ ...baseBrowserConfig.output,\nfilename: 'dev.build.js',\npathinfo: true,\npublicPath: 'http://localhost:8080/',\n},\n- plugins: [\n- ...browserConfig.plugins,\n- new webpack.DefinePlugin({\n- 'process.env': {\n- NODE_ENV: JSON.stringify('dev'),\n- BROWSER: true,\n- },\n- }),\n- ],\n- module: {\n- rules: [\n- {\n- ...browserBabelRule,\n- options: {\n- ...browserBabelRule.options,\n- plugins: [\n- 'react-hot-loader/babel',\n- ...browserBabelRule.options.plugins,\n- ],\n- },\n- },\n- imageRule,\n- {\n- test: /\\.css$/,\n- exclude: /node_modules\\/.*\\.css$/,\n- use: [styleLoader, cssLoader],\n- },\n- {\n- test: /node_modules\\/.*\\.css$/,\n- use: [\n- styleLoader,\n- {\n- ...cssLoader,\n- options: {\n- ...cssLoader.options,\n- modules: false,\n- },\n- },\n- ],\n- },\n- ],\n- },\n- devtool: 'eval-cheap-module-source-map',\ndevServer: {\nhot: true,\nport: 8080,\ncontentBase: path.join(__dirname, 'dist'),\nheaders: { 'Access-Control-Allow-Origin': '*' },\n},\n- resolve: {\n- ...browserConfig.resolve,\n- alias: {\n- ...browserConfig.resolve.alias,\n- 'react-dom': '@hot-loader/react-dom',\n- },\n- },\n};\n- } else {\n- browserConfig = {\n- ...browserConfig,\n- mode: 'production',\n+\n+const baseProdBrowserConfig = {\n+ ...baseBrowserConfig,\nplugins: [\n- ...browserConfig.plugins,\n- new webpack.DefinePlugin({\n- 'process.env': {\n- NODE_ENV: JSON.stringify('production'),\n- BROWSER: true,\n- },\n- }),\n- new MiniCssExtractPlugin({\n- filename: 'prod.[contenthash:12].build.css',\n- }),\nnew AssetsPlugin({\nfilename: 'assets.json',\npath: path.join(__dirname, 'dist'),\n}),\n],\n- module: {\n- rules: [\n- {\n- ...browserBabelRule,\n- options: {\n- ...browserBabelRule.options,\n- plugins: [\n- ...browserBabelRule.options.plugins,\n- '@babel/plugin-transform-react-constant-elements',\n- 'transform-remove-console',\n- ],\n- },\n- },\n- {\n- test: /\\.css$/,\n- exclude: /node_modules\\/.*\\.css$/,\n- use: [\n- cssExtractLoader,\n- {\n- ...cssLoader,\n- options: {\n- ...cssLoader.options,\n- url: false,\n- },\n- },\n- ],\n- },\n- {\n- test: /node_modules\\/.*\\.css$/,\n- use: [\n- cssExtractLoader,\n- {\n- ...cssLoader,\n- options: {\n- ...cssLoader.options,\n- url: false,\n- modules: false,\n- },\n- },\n- ],\n- },\n- ],\n- },\n};\n- }\n- const nodeServerRenderingConfig = {\n- name: 'server',\n- target: 'node',\n+\n+const baseNodeServerRenderingConfig = {\nexternals: ['react', 'react-dom', 'react-redux'],\n- mode: env === 'dev' ? 'development' : 'production',\nentry: {\nserver: ['./app.react.js'],\n},\n@@ -245,25 +60,19 @@ module.exports = function (env) {\nlibraryTarget: 'commonjs2',\npath: path.join(__dirname, 'dist'),\n},\n- module: {\n- rules: [\n- babelRule,\n- {\n- test: /\\.css$/,\n- use: {\n- ...cssLoader,\n- options: {\n- ...cssLoader.options,\n- modules: {\n- ...cssLoader.options.modules,\n- exportOnlyLocals: true,\n- },\n- },\n- },\n- },\n- ],\n- },\n- plugins: sharedPlugins,\n+};\n+\n+module.exports = function (env) {\n+ const browserConfig = env === 'prod'\n+ ? createProdBrowserConfig(baseProdBrowserConfig, babelConfig)\n+ : createDevBrowserConfig(baseDevBrowserConfig, babelConfig);\n+ const nodeConfig = createNodeServerRenderingConfig(\n+ baseNodeServerRenderingConfig,\n+ babelConfig,\n+ );\n+ const nodeServerRenderingConfig = {\n+ ...nodeConfig,\n+ mode: env === 'dev' ? 'development' : 'production',\n};\nreturn [browserConfig, nodeServerRenderingConfig];\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | Factor out shared webpack config into lib/webpack/shared.cjs
Summary: We're going to use this in the upcoming `landing` project.
Test Plan: Make sure Webpack still builds and server still returns a working webpage on both dev and prod
Reviewers: atul, palys-swm
Reviewed By: atul
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D963 |
129,187 | 05.04.2021 15:13:29 | 14,400 | 5fa613d01d9f004a7ee8a2d26d02b4f2c6f9e4c2 | [landing] Hello World for landing page
Summary: Hot refresh, Webpack working
Test Plan: Load the loading page at `http://localhost/comm/misc/landing.html` and confirm hot refresh works if you edit `landing/landing.react.js`
Reviewers: atul, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": ".DS_Store\nnode_modules\n+landing/node_modules\n+landing/dist\nlib/node_modules\n-web/node_modules/*\n+web/node_modules\nweb/dist\nserver/dist\n-server/node_modules/*\n+server/node_modules\nserver/secrets\nserver/facts\n.eslintcache\n"
},
{
"change_type": "MODIFY",
"old_path": ".lintstagedrc.js",
"new_path": ".lintstagedrc.js",
"diff": "@@ -18,4 +18,7 @@ module.exports = {\n'{server,web,lib}/**/*.js': function serverFlow(files) {\nreturn 'yarn workspace server flow --quiet';\n},\n+ '{landing,lib}/**/*.js': function serverFlow(files) {\n+ return 'yarn workspace landing flow --quiet';\n+ },\n};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/.eslintrc.json",
"diff": "+{\n+ \"env\": {\n+ \"browser\": true\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/.flowconfig",
"diff": "+[options]\n+module.name_mapper.extension='css' -> '<PROJECT_ROOT>/flow/CSSModule.js.flow'\n+esproposal.optional_chaining=enable\n+esproposal.nullish_coalescing=enable\n+\n+[lints]\n+sketchy-null-number=warn\n+sketchy-null-mixed=warn\n+sketchy-number=warn\n+untyped-type-import=warn\n+nonstrict-import=warn\n+deprecated-type=warn\n+unsafe-getters-setters=warn\n+unnecessary-invariant=warn\n+signature-verification-failure=warn\n+deprecated-utility=error\n+\n+[strict]\n+deprecated-type\n+nonstrict-import\n+sketchy-null\n+unclear-type\n+unsafe-getters-setters\n+untyped-import\n+untyped-type-import\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/babel.config.cjs",
"diff": "+module.exports = {\n+ presets: ['@babel/preset-react', '@babel/preset-flow'],\n+ plugins: [\n+ '@babel/plugin-proposal-class-properties',\n+ '@babel/plugin-proposal-object-rest-spread',\n+ '@babel/plugin-proposal-optional-chaining',\n+ '@babel/plugin-proposal-nullish-coalescing-operator',\n+ ['@babel/plugin-transform-runtime', { useESModules: true }],\n+ ],\n+};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/flow/CSSModule.js.flow",
"diff": "+// @flow\n+\n+declare export default { [key: string]: string };\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/landing.react.js",
"diff": "+// @flow\n+\n+import * as React from 'react';\n+\n+function Landing() {\n+ return <span>Hello World!</span>;\n+}\n+\n+export default Landing;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/package.json",
"diff": "+{\n+ \"name\": \"landing\",\n+ \"version\": \"0.0.1\",\n+ \"type\": \"module\",\n+ \"private\": true,\n+ \"license\": \"BSD-3-Clause\",\n+ \"scripts\": {\n+ \"clean\": \"rm -rf dist/ && rm -rf node_modules/\",\n+ \"dev\": \"yarn concurrently --names=\\\"NODESSR,BROWSER\\\" -c \\\"bgBlue.bold,bgMagenta.bold\\\" \\\"yarn webpack --config webpack.config.cjs --config-name=server --watch\\\" \\\"yarn webpack-dev-server --hot --config webpack.config.cjs --config-name=browser\\\"\",\n+ \"prod\": \"yarn webpack --config webpack.config.cjs --env prod --progress\"\n+ },\n+ \"devDependencies\": {\n+ \"@babel/core\": \"^7.13.14\",\n+ \"@babel/plugin-proposal-class-properties\": \"^7.13.0\",\n+ \"@babel/plugin-proposal-nullish-coalescing-operator\": \"^7.13.8\",\n+ \"@babel/plugin-proposal-object-rest-spread\": \"^7.13.8\",\n+ \"@babel/plugin-proposal-optional-chaining\": \"^7.13.12\",\n+ \"@babel/plugin-transform-react-constant-elements\": \"^7.13.13\",\n+ \"@babel/plugin-transform-runtime\": \"^7.13.10\",\n+ \"@babel/preset-env\": \"^7.13.12\",\n+ \"@babel/preset-flow\": \"^7.13.13\",\n+ \"@babel/preset-react\": \"^7.13.13\",\n+ \"@hot-loader/react-dom\": \"16.13.0\",\n+ \"assets-webpack-plugin\": \"^3.9.7\",\n+ \"babel-loader\": \"^8.1.0\",\n+ \"babel-plugin-transform-remove-console\": \"^6.9.4\",\n+ \"clean-webpack-plugin\": \"^3.0.0\",\n+ \"concurrently\": \"^5.3.0\",\n+ \"css-loader\": \"^4.3.0\",\n+ \"flow-bin\": \"^0.122.0\",\n+ \"flow-typed\": \"^3.2.1\",\n+ \"mini-css-extract-plugin\": \"^0.11.2\",\n+ \"optimize-css-assets-webpack-plugin\": \"^5.0.3\",\n+ \"style-loader\": \"^1.2.1\",\n+ \"terser-webpack-plugin\": \"^2.1.2\",\n+ \"url-loader\": \"^2.2.0\",\n+ \"webpack\": \"^4.41.0\",\n+ \"webpack-cli\": \"^3.3.9\",\n+ \"webpack-dev-server\": \"^3.11.0\"\n+ },\n+ \"dependencies\": {\n+ \"@babel/runtime\": \"^7.13.10\",\n+ \"core-js\": \"^3.6.5\",\n+ \"invariant\": \"^2.2.4\",\n+ \"isomorphic-fetch\": \"^2.2.1\",\n+ \"lib\": \"0.0.1\",\n+ \"react\": \"16.13.1\",\n+ \"react-dom\": \"16.13.1\",\n+ \"react-hot-loader\": \"^4.12.14\"\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/root.js",
"diff": "+// @flow\n+\n+import * as React from 'react';\n+import { hot } from 'react-hot-loader/root';\n+\n+import Landing from './landing.react';\n+\n+function RootComponent() {\n+ return <Landing />;\n+}\n+\n+export default hot(RootComponent);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/script.js",
"diff": "+// @flow\n+\n+import 'isomorphic-fetch';\n+\n+import invariant from 'invariant';\n+import React from 'react';\n+import ReactDOM from 'react-dom';\n+\n+import Root from './root';\n+\n+const root = document.getElementById('react-root');\n+invariant(root, \"cannot find id='react-root' element!\");\n+\n+ReactDOM.render(<Root />, root);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/webpack.config.cjs",
"diff": "+const path = require('path');\n+const AssetsPlugin = require('assets-webpack-plugin');\n+\n+const babelConfig = require('./babel.config.cjs');\n+const {\n+ createProdBrowserConfig,\n+ createDevBrowserConfig,\n+ createNodeServerRenderingConfig,\n+} = require('lib/webpack/shared.cjs');\n+\n+const baseBrowserConfig = {\n+ entry: {\n+ browser: ['./script.js'],\n+ },\n+ output: {\n+ filename: 'prod.[hash:12].build.js',\n+ path: path.join(__dirname, 'dist'),\n+ },\n+ resolve: {\n+ alias: {\n+ '../images': path.resolve('../server/images'),\n+ },\n+ },\n+};\n+\n+const baseDevBrowserConfig = {\n+ ...baseBrowserConfig,\n+ output: {\n+ ...baseBrowserConfig.output,\n+ filename: 'dev.build.js',\n+ pathinfo: true,\n+ publicPath: 'http://localhost:8082/',\n+ },\n+ devServer: {\n+ hot: true,\n+ port: 8082,\n+ contentBase: path.join(__dirname, 'dist'),\n+ headers: { 'Access-Control-Allow-Origin': '*' },\n+ },\n+};\n+\n+const baseProdBrowserConfig = {\n+ ...baseBrowserConfig,\n+ plugins: [\n+ new AssetsPlugin({\n+ filename: 'assets.json',\n+ path: path.join(__dirname, 'dist'),\n+ }),\n+ ],\n+};\n+\n+const baseNodeServerRenderingConfig = {\n+ externals: ['react', 'react-dom', 'react-redux'],\n+ entry: {\n+ server: ['./landing.react.js'],\n+ },\n+ output: {\n+ filename: 'landing.build.cjs',\n+ library: 'landing',\n+ libraryTarget: 'commonjs2',\n+ path: path.join(__dirname, 'dist'),\n+ },\n+};\n+\n+module.exports = function (env) {\n+ const browserConfig = env === 'prod'\n+ ? createProdBrowserConfig(baseProdBrowserConfig, babelConfig)\n+ : createDevBrowserConfig(baseDevBrowserConfig, babelConfig);\n+ const nodeConfig = createNodeServerRenderingConfig(\n+ baseNodeServerRenderingConfig,\n+ babelConfig,\n+ );\n+ const nodeServerRenderingConfig = {\n+ ...nodeConfig,\n+ mode: env === 'dev' ? 'development' : 'production',\n+ };\n+ return [browserConfig, nodeServerRenderingConfig];\n+};\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"lib\",\n\"web\",\n\"native\",\n- \"server\"\n+ \"server\",\n+ \"landing\"\n],\n\"scripts\": {\n- \"clean\": \"yarn workspace lib clean && yarn workspace web clean && yarn workspace native clean && yarn workspace server clean && rm -rf node_modules/\",\n+ \"clean\": \"yarn workspace lib clean && yarn workspace web clean && yarn workspace native clean && yarn workspace server clean && yarn workspace landing clean && rm -rf node_modules/\",\n\"cleaninstall\": \"yarn clean && yarn\",\n\"eslint\": \"eslint .\",\n\"eslint:fix\": \"eslint --fix .\"\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/misc/landing.html",
"diff": "+<!DOCTYPE html>\n+<html lang=\"en\">\n+ <head>\n+ <meta charset=\"utf-8\" />\n+ <title>Hello world</title>\n+ <base href=\"/misc/\" />\n+ </head>\n+ <body>\n+ <div id=\"react-root\" />\n+ <script src=\"http://localhost:8082/dev.build.js\"></script>\n+ </body>\n+</html>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Hello World for landing page
Summary: Hot refresh, Webpack working
Test Plan: Load the loading page at `http://localhost/comm/misc/landing.html` and confirm hot refresh works if you edit `landing/landing.react.js`
Reviewers: atul, palys-swm
Reviewed By: atul
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D965 |
129,187 | 05.04.2021 16:14:56 | 14,400 | 425775eef9ba9118ba727ac3e9260ea4acc80592 | [server] Add getLandingURLFacts and landing_url.json
Test Plan: Tested in conjunction with future diffs
Reviewers: atul, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "docs/dev_environment.md",
"new_path": "docs/dev_environment.md",
"diff": "@@ -461,6 +461,22 @@ Your `app_url.json` file should look like this:\n}\n```\n+Finally, we'll create a file for the URLs in the landing page.\n+\n+```\n+vim server/facts/landing_url.json\n+```\n+\n+Your `landing_url.json` file should look like this:\n+\n+```json\n+{\n+ \"baseDomain\": \"http://localhost\",\n+ \"basePath\": \"/commlanding/\",\n+ \"https\": false\n+}\n+```\n+\n## Phabricator\nThe last configuration step is to set up an account on Phabricator, where we handle code review. Start by [logging in to Phabricator](https://phabricator.ashoat.com) using your GitHub account.\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/utils/urls.js",
"new_path": "server/src/utils/urls.js",
"diff": "// @flow\nimport appURLFacts from '../../facts/app_url';\n+import landingURLFacts from '../../facts/landing_url';\nimport baseURLFacts from '../../facts/url';\ntype GlobalURLFacts = {|\n@@ -21,4 +22,8 @@ function getAppURLFacts(): SiteURLFacts {\nreturn appURLFacts;\n}\n-export { getGlobalURLFacts, getAppURLFacts };\n+function getLandingURLFacts(): SiteURLFacts {\n+ return landingURLFacts;\n+}\n+\n+export { getGlobalURLFacts, getAppURLFacts, getLandingURLFacts };\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Add getLandingURLFacts and landing_url.json
Test Plan: Tested in conjunction with future diffs
Reviewers: atul, palys-swm
Reviewed By: atul
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D967 |
129,187 | 05.04.2021 16:29:04 | 14,400 | c6b3325e503d81dc4d8d89dbb7c0404779406c4e | [server] Create landing_compiled symlink and move old compiled symlink to app_compiled
Test Plan: Make sure server still returns a working website
Reviewers: atul, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": ".eslintignore",
"new_path": ".eslintignore",
"diff": "@@ -3,7 +3,8 @@ lib/node_modules\nweb/dist\nweb/flow-typed\nweb/node_modules\n-server/compiled\n+server/app_compiled\n+server/landing_compiled\nserver/dist\nserver/secrets\nserver/facts\n"
},
{
"change_type": "MODIFY",
"old_path": ".prettierignore",
"new_path": ".prettierignore",
"diff": "lib/flow-typed\nweb/dist\nweb/flow-typed\n-server/compiled\n+server/app_compiled\n+server/landing_compiled\nserver/dist\nserver/secrets\nserver/facts\n"
},
{
"change_type": "RENAME",
"old_path": "server/compiled",
"new_path": "server/app_compiled",
"diff": ""
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/landing_compiled",
"diff": "+../landing/dist/\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/website-responders.js",
"new_path": "server/src/responders/website-responders.js",
"diff": "@@ -77,8 +77,8 @@ async function getAssetInfo() {\n};\nreturn assetInfo;\n}\n- // $FlowFixMe compiled/assets.json doesn't always exist\n- const { default: assets } = await import('../../compiled/assets');\n+ // $FlowFixMe app_compiled/assets.json doesn't always exist\n+ const { default: assets } = await import('../../app_compiled/assets');\nassetInfo = {\njsURL: `compiled/${assets.browser.js}`,\nfontsURL: googleFontsURL,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -58,7 +58,14 @@ if (cluster.isMaster) {\nprocess.env.NODE_ENV === 'dev'\n? undefined\n: { maxAge: '1y', immutable: true };\n- router.use('/compiled', express.static('compiled', compiledFolderOptions));\n+ router.use(\n+ '/compiled',\n+ express.static('app_compiled', compiledFolderOptions),\n+ );\n+ router.use(\n+ '/commlanding/compiled',\n+ express.static('landing_compiled', compiledFolderOptions),\n+ );\nrouter.use('/', express.static('icons'));\nfor (const endpoint in jsonEndpoints) {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Create landing_compiled symlink and move old compiled symlink to app_compiled
Test Plan: Make sure server still returns a working website
Reviewers: atul, palys-swm
Reviewed By: atul
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D968 |
129,187 | 05.04.2021 19:39:51 | 14,400 | e2ff81665e711de7a658fd255519523ba58ec374 | [server] Make it possible to access landing from server
Test Plan: Tested in conjunction with future diffs
Reviewers: atul, palys-swm
Subscribers: KatPo, zrebcu411, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "server/.flowconfig",
"new_path": "server/.flowconfig",
"diff": ".*/web/flow-typed\n[include]\n+../landing\n../lib\n../web\n"
},
{
"change_type": "MODIFY",
"old_path": "server/loader.mjs",
"new_path": "server/loader.mjs",
"diff": "+const localPackages = ['landing', 'lib', 'web'];\n+\nasync function resolve(specifier, context, defaultResolve) {\nconst defaultResult = defaultResolve(specifier, context, defaultResolve);\n// Special hack to use Babel-transpiled lib and web\n- if (specifier.startsWith('lib/') || specifier.startsWith('web/')) {\n+ if (localPackages.some(pkg => specifier.startsWith(`${pkg}/`))) {\nconst url = defaultResult.url.replace(\nspecifier,\n`server/dist/${specifier}`,\n"
},
{
"change_type": "MODIFY",
"old_path": "server/package.json",
"new_path": "server/package.json",
"diff": "\"main\": \"dist/server\",\n\"scripts\": {\n\"clean\": \"rm -rf dist/ && rm -rf node_modules/ && mkdir dist\",\n- \"babel-build\": \"yarn --silent babel src/ --out-dir dist/ --config-file ./babel.config.cjs --verbose --ignore 'src/lib/flow-typed','src/lib/node_modules','src/lib/package.json','src/web/flow-typed','src/web/node_modules','src/web/package.json','src/web/dist','src/web/webpack.config.js','src/web/account-bar.react.js','src/web/app.react.js','src/web/calendar','src/web/chat','src/web/flow','src/web/loading-indicator.react.js','src/web/modals','src/web/root.js','src/web/router-history.js','src/web/script.js','src/web/selectors/chat-selectors.js','src/web/selectors/entry-selectors.js','src/web/splash','src/web/vector-utils.js','src/web/vectors.react.js'\",\n+ \"babel-build\": \"yarn --silent babel src/ --out-dir dist/ --config-file ./babel.config.cjs --verbose --ignore 'src/landing/flow-typed','src/landing/node_modules','src/landing/package.json','src/lib/flow-typed','src/lib/node_modules','src/lib/package.json','src/web/flow-typed','src/web/node_modules','src/web/package.json','src/web/dist','src/web/webpack.config.js','src/web/account-bar.react.js','src/web/app.react.js','src/web/calendar','src/web/chat','src/web/flow','src/web/loading-indicator.react.js','src/web/modals','src/web/root.js','src/web/router-history.js','src/web/script.js','src/web/selectors/chat-selectors.js','src/web/selectors/entry-selectors.js','src/web/splash','src/web/vector-utils.js','src/web/vectors.react.js'\",\n\"rsync\": \"rsync -rLpmuv --exclude '*/package.json' --exclude '*/node_modules/*' --include '*.json' --include '*.cjs' --exclude '*.*' src/ dist/\",\n\"prod-build\": \"yarn babel-build && yarn rsync && yarn update-geoip\",\n\"update-geoip\": \"yarn script dist/scripts/update-geoip.js\",\n\"firebase-admin\": \"^9.2.0\",\n\"geoip-lite\": \"^1.4.0\",\n\"invariant\": \"^2.2.4\",\n+ \"landing\": \"0.0.1\",\n\"lib\": \"0.0.1\",\n\"lodash\": \"^4.17.19\",\n\"multer\": \"^1.4.1\",\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/landing",
"diff": "+../../landing\n\\ No newline at end of file\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Make it possible to access landing from server
Test Plan: Tested in conjunction with future diffs
Reviewers: atul, palys-swm
Reviewed By: atul
Subscribers: KatPo, zrebcu411, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D970 |
129,187 | 06.04.2021 15:51:42 | 14,400 | a7e595d4e504c366718b2efb38758b9eabc0c44d | [landing] Flow updates
Summary:
These updates are necessary to make `landing` page work with `flow-bin@0.137.0`, which is the version associated with `react-native@0.64.0`.
Wanted to submit them now to avoid having to deal with any rebasing later.
Test Plan: Flow
Reviewers: atul
Subscribers: KatPo, zrebcu411, palys-swm, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "landing/.flowconfig",
"new_path": "landing/.flowconfig",
"diff": "+[include]\n+../lib\n+\n+[libs]\n+../lib/flow-typed\n+\n[options]\nmodule.name_mapper.extension='css' -> '<PROJECT_ROOT>/flow/CSSModule.js.flow'\nesproposal.optional_chaining=enable\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "import * as React from 'react';\n-function Landing() {\n+function Landing(): React.Node {\nreturn <span>Hello World!</span>;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/root.js",
"new_path": "landing/root.js",
"diff": "@@ -9,4 +9,6 @@ function RootComponent() {\nreturn <Landing />;\n}\n-export default hot(RootComponent);\n+const HotReloadingRootComponent: React.ComponentType<{||}> = hot(RootComponent);\n+\n+export default HotReloadingRootComponent;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Flow updates
Summary:
These updates are necessary to make `landing` page work with `flow-bin@0.137.0`, which is the version associated with `react-native@0.64.0`.
Wanted to submit them now to avoid having to deal with any rebasing later.
Test Plan: Flow
Reviewers: atul
Reviewed By: atul
Subscribers: KatPo, zrebcu411, palys-swm, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D973 |
129,184 | 07.04.2021 11:42:22 | 14,400 | 4fa4c2eadeb8696d61dbfaf81d0268dbc49b7a52 | [landing] Change landing page title to Comm
Summary: NA
Test Plan: NA
Reviewers: ashoat
Subscribers: KatPo, zrebcu411, palys-swm, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "server/src/responders/landing-handler.js",
"new_path": "server/src/responders/landing-handler.js",
"diff": "@@ -52,7 +52,7 @@ async function landingResponder(req: $Request, res: $Response) {\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\" />\n- <title>Hello world</title>\n+ <title>Comm</title>\n<base href=\"${basePath}\" />\n</head>\n<body>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Change landing page title to Comm
Summary: NA
Test Plan: NA
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, palys-swm, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D976 |
129,184 | 07.04.2021 17:57:10 | 14,400 | bca0dfc26e36dbccaa16d1fd1cad308e859ba9b3 | [landing] Radial gradient background for landing page
Summary: Recreate radial gradient from figma
Test Plan: NA
Reviewers: ashoat
Subscribers: KatPo, zrebcu411, palys-swm, Adrian, subnub | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/landing.css",
"diff": "+html {\n+ overflow: hidden;\n+ height: 100%;\n+ background: radial-gradient(ellipse at bottom, #374151, #111827);\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "// @flow\nimport * as React from 'react';\n+import './landing.css';\nfunction Landing(): React.Node {\nreturn <span>Hello World!</span>;\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/landing-handler.js",
"new_path": "server/src/responders/landing-handler.js",
"diff": "@@ -6,6 +6,7 @@ import Landing from 'landing/dist/landing.build.cjs';\nimport * as React from 'react';\nimport ReactDOMServer from 'react-dom/server';\n+import { waitForStream } from '../utils/json-stream';\nimport { getLandingURLFacts } from '../utils/urls';\nimport { getMessageForException } from './utils';\n@@ -20,7 +21,7 @@ async function landingHandler(req: $Request, res: $Response) {\n}\n}\n-type AssetInfo = {| +jsURL: string |};\n+type AssetInfo = {| +jsURL: string, +cssInclude: string |};\nlet assetInfo: ?AssetInfo = null;\nasync function getAssetInfo() {\nif (assetInfo) {\n@@ -29,6 +30,7 @@ async function getAssetInfo() {\nif (process.env.NODE_ENV === 'dev') {\nassetInfo = {\njsURL: 'http://localhost:8082/dev.build.js',\n+ cssInclude: '',\n};\nreturn assetInfo;\n}\n@@ -36,6 +38,13 @@ async function getAssetInfo() {\nconst { default: assets } = await import('../../landing_compiled/assets');\nassetInfo = {\njsURL: `compiled/${assets.browser.js}`,\n+ cssInclude: html`\n+ <link\n+ rel=\"stylesheet\"\n+ type=\"text/css\"\n+ href=\"compiled/${assets.browser.css}\"\n+ />\n+ `,\n};\nreturn assetInfo;\n}\n@@ -44,7 +53,7 @@ const { basePath } = getLandingURLFacts();\nconst { renderToNodeStream } = ReactDOMServer;\nasync function landingResponder(req: $Request, res: $Response) {\n- const assetInfoPromise = getAssetInfo();\n+ const { jsURL, cssInclude } = await getAssetInfo();\n// prettier-ignore\nres.write(html`\n@@ -54,6 +63,7 @@ async function landingResponder(req: $Request, res: $Response) {\n<meta charset=\"utf-8\" />\n<title>Comm</title>\n<base href=\"${basePath}\" />\n+ ${cssInclude}\n</head>\n<body>\n<div id=\"react-root\">\n@@ -62,8 +72,7 @@ async function landingResponder(req: $Request, res: $Response) {\nconst LandingRoot = Landing.default;\nconst reactStream = renderToNodeStream(<LandingRoot />);\nreactStream.pipe(res, { end: false });\n-\n- const { jsURL } = await assetInfoPromise;\n+ await waitForStream(reactStream);\n// prettier-ignore\nres.end(html`</div>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Radial gradient background for landing page
Summary: Recreate radial gradient from figma
Test Plan: NA
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, palys-swm, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D977 |
129,184 | 08.04.2021 14:19:06 | 14,400 | 7e82fd73953180574519f00fff86b9924e596a49 | [landing] Recreate parallax star effect with `react-particles-js`
Summary:
Introduce `react-particle-js`:
Here's what it looks like:
Test Plan: NA
Reviewers: ashoat
Subscribers: KatPo, zrebcu411, palys-swm, Adrian, subnub | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.css",
"new_path": "landing/landing.css",
"diff": "@@ -7,4 +7,5 @@ html {\nh1 {\nfont-family: 'IBM Plex Sans', sans-serif;\ncolor: white;\n+ font-size: 28px;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "// @flow\nimport * as React from 'react';\n+import Particles from 'react-particles-js';\n+\nimport './landing.css';\n+import particlesConfig from './particles-config.json';\nfunction Landing(): React.Node {\n- return <h1>Hello World!</h1>;\n+ return (\n+ <div>\n+ <h1>Comm</h1>\n+ <Particles height=\"100vh\" width=\"100vw\" params={particlesConfig} />\n+ </div>\n+ );\n}\nexport default Landing;\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/package.json",
"new_path": "landing/package.json",
"diff": "\"lib\": \"0.0.1\",\n\"react\": \"16.13.1\",\n\"react-dom\": \"16.13.1\",\n- \"react-hot-loader\": \"^4.12.14\"\n+ \"react-hot-loader\": \"^4.12.14\",\n+ \"react-particles-js\": \"^3.4.1\"\n}\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/particles-config.json",
"diff": "+{\n+ \"particles\": {\n+ \"number\": {\n+ \"value\": 30,\n+ \"density\": {\n+ \"enable\": true,\n+ \"value_area\": 800\n+ }\n+ },\n+ \"color\": {\n+ \"value\": \"#ffffff\"\n+ },\n+ \"opacity\": {\n+ \"value\": 1,\n+ \"random\": false,\n+ \"anim\": {\n+ \"enable\": true,\n+ \"speed\": 0.5,\n+ \"opacity_min\": 0.8,\n+ \"sync\": false\n+ }\n+ },\n+ \"size\": {\n+ \"value\": 2,\n+ \"random\": true,\n+ \"anim\": {\n+ \"enable\": false,\n+ \"speed\": 4,\n+ \"size_min\": 0.2,\n+ \"sync\": false\n+ }\n+ },\n+ \"line_linked\": {\n+ \"enable\": false,\n+ \"distance\": 150,\n+ \"color\": \"#ffffff\",\n+ \"opacity\": 0.4,\n+ \"width\": 1\n+ },\n+ \"move\": {\n+ \"enable\": true,\n+ \"speed\": 1.5,\n+ \"direction\": \"top\",\n+ \"random\": false,\n+ \"straight\": true,\n+ \"out_mode\": \"out\",\n+ \"bounce\": false,\n+ \"attract\": {\n+ \"enable\": false,\n+ \"rotateX\": 600,\n+ \"rotateY\": 600\n+ }\n+ }\n+ },\n+ \"interactivity\": {\n+ \"detect_on\": \"canvas\",\n+ \"events\": {\n+ \"onhover\": {\n+ \"enable\": true,\n+ \"mode\": \"grab\"\n+ },\n+ \"resize\": true\n+ },\n+ \"modes\": {\n+ \"grab\": {\n+ \"distance\": 85,\n+ \"line_linked\": {\n+ \"opacity\": 0.4\n+ }\n+ }\n+ }\n+ },\n+ \"retina_detect\": true\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -12975,6 +12975,11 @@ path-type@^4.0.0:\nresolved \"https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b\"\nintegrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==\n+pathseg@^1.2.0:\n+ version \"1.2.0\"\n+ resolved \"https://registry.yarnpkg.com/pathseg/-/pathseg-1.2.0.tgz#22af051e28037671e7799e296fe96c5dcbe53acd\"\n+ integrity sha512-+pQS7lTaoVIXhaCW7R3Wd/165APzZHWzYVqe7dxzdupxQwebgpBaCmf0/XZwmoA/rkDq3qvzO0qv4d5oFVrBRw==\n+\npbkdf2@^3.0.3:\nversion \"3.0.17\"\nresolved \"https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.17.tgz#976c206530617b14ebb32114239f7b09336e93a6\"\n@@ -14171,6 +14176,14 @@ react-native@0.63.4:\nuse-subscription \"^1.0.0\"\nwhatwg-fetch \"^3.0.0\"\n+react-particles-js@^3.4.1:\n+ version \"3.4.1\"\n+ resolved \"https://registry.yarnpkg.com/react-particles-js/-/react-particles-js-3.4.1.tgz#e0f17ae1ddb07d01ce911448db76cd59726fe666\"\n+ integrity sha512-c3+vITUMN9RlgbERZYd9Kzvjmf49ENp07+9+NDLvE1Jf9euabrJi/q6gCCcv5foxGHBYjHnGs47Tusmrl0/+GQ==\n+ dependencies:\n+ lodash \"^4.17.11\"\n+ tsparticles \"^1.18.10\"\n+\nreact-redux@^7.1.1:\nversion \"7.1.1\"\nresolved \"https://registry.yarnpkg.com/react-redux/-/react-redux-7.1.1.tgz#ce6eee1b734a7a76e0788b3309bf78ff6b34fa0a\"\n@@ -16370,6 +16383,13 @@ tslib@^1.8.1, tslib@^1.9.0:\nresolved \"https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a\"\nintegrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==\n+tsparticles@^1.18.10:\n+ version \"1.26.0\"\n+ resolved \"https://registry.yarnpkg.com/tsparticles/-/tsparticles-1.26.0.tgz#12469eb8e26a17aad2aa01b6c796fec26415508c\"\n+ integrity sha512-W2VAz1n1ffF/JqWiC54+R8DrH8Ar+GKoAkAJPIKHRV5lQZVqF7qhkSmRyXenzkfJ6P847Dj7LZG4NjRYGr0Ipg==\n+ optionalDependencies:\n+ pathseg \"^1.2.0\"\n+\ntsutils@^3.17.1:\nversion \"3.17.1\"\nresolved \"https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Recreate parallax star effect with `react-particles-js`
Summary:
Introduce `react-particle-js`: https://github.com/Wufe/react-particles-js
Here's what it looks like: https://blob.sh/atul/parallax.mov
Test Plan: NA
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, palys-swm, Adrian, subnub
Differential Revision: https://phabricator.ashoat.com/D978 |
129,184 | 08.04.2021 15:34:35 | 14,400 | 7f6399eac6d3fcda3a5c7d464acc1a83db803799 | [landing] Add SVG to imageRule
Summary: Add SVG to imageRule so we can incorporate the illustrations from figma
Test Plan: I was able to add the eyeball illustration to the page (https://blob.sh/atul/eyeball.png)
Reviewers: ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "lib/webpack/shared.cjs",
"new_path": "lib/webpack/shared.cjs",
"diff": "@@ -63,7 +63,7 @@ function getBrowserBabelRule(babelConfig) {\n}\nconst imageRule = {\n- test: /\\.png$/,\n+ test: /\\.(png|svg)$/,\nuse: ['url-loader'],\n};\n@@ -173,10 +173,7 @@ function createDevBrowserConfig(baseConfig, babelConfig) {\n...babelRule,\noptions: {\n...babelRule.options,\n- plugins: [\n- 'react-hot-loader/babel',\n- ...babelRule.options.plugins,\n- ],\n+ plugins: ['react-hot-loader/babel', ...babelRule.options.plugins],\n},\n},\nimageRule,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Add SVG to imageRule
Summary: Add SVG to imageRule so we can incorporate the illustrations from figma
Test Plan: I was able to add the eyeball illustration to the page (https://blob.sh/atul/eyeball.png)
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D984 |
129,191 | 22.03.2021 17:14:50 | -3,600 | cbe4defdd26196f94e0810d712a746baacd88777 | [lib] Use parameters object in createRealThreadFromPendingThread function
Test Plan: Flow
Reviewers: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/thread-utils.js",
"new_path": "lib/shared/thread-utils.js",
"diff": "@@ -402,14 +402,22 @@ function pendingThreadType(numberOfOtherMembers: number) {\n: threadTypes.CHAT_SECRET;\n}\n-async function createRealThreadFromPendingThread(\n- threadInfo: ThreadInfo,\n- dispatchActionPromise: DispatchActionPromise,\n- createNewThread: (request: NewThreadRequest) => Promise<NewThreadResult>,\n- sourceMessageID: ?string,\n- viewerID: ?string,\n- handleError?: () => mixed,\n-): Promise<?string> {\n+type CreateRealThreadParameters = {|\n+ +threadInfo: ThreadInfo,\n+ +dispatchActionPromise: DispatchActionPromise,\n+ +createNewThread: (NewThreadRequest) => Promise<NewThreadResult>,\n+ +sourceMessageID: ?string,\n+ +viewerID: ?string,\n+ +handleError?: () => mixed,\n+|};\n+async function createRealThreadFromPendingThread({\n+ threadInfo,\n+ dispatchActionPromise,\n+ createNewThread,\n+ sourceMessageID,\n+ viewerID,\n+ handleError,\n+}: CreateRealThreadParameters): Promise<?string> {\nif (!threadIsPending(threadInfo.id)) {\nreturn threadInfo.id;\n}\n@@ -486,14 +494,14 @@ function useRealThreadCreator(\n} else if (!threadInfo) {\nreturn null;\n}\n- const newThreadID = await createRealThreadFromPendingThread(\n+ const newThreadID = await createRealThreadFromPendingThread({\nthreadInfo,\ndispatchActionPromise,\n- callNewThread,\n+ createNewThread: callNewThread,\nsourceMessageID,\nviewerID,\nhandleError,\n- );\n+ });\ncreationResultRef.current = {\npendingThreadID: threadInfo.id,\nserverThreadID: newThreadID,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/input/input-state-container.react.js",
"new_path": "native/input/input-state-container.react.js",
"diff": "@@ -341,13 +341,13 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nlet newThreadID;\ntry {\n- newThreadID = await createRealThreadFromPendingThread(\n+ newThreadID = await createRealThreadFromPendingThread({\nthreadInfo,\n- this.props.dispatchActionPromise,\n- this.props.newThread,\n- threadInfo.sourceMessageID,\n- this.props.viewerID,\n- );\n+ dispatchActionPromise: this.props.dispatchActionPromise,\n+ createNewThread: this.props.newThread,\n+ sourceMessageID: threadInfo.sourceMessageID,\n+ viewerID: this.props.viewerID,\n+ });\n} catch (e) {\nnewThreadID = undefined;\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Use parameters object in createRealThreadFromPendingThread function
Test Plan: Flow
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, zrebcu411, Adrian, atul, subnub
Differential Revision: https://phabricator.ashoat.com/D927 |
129,184 | 08.04.2021 17:10:46 | 14,400 | 3756cf49a54fafca83035c538db5dc6a21821adb | [landing] add landing workspace description to readme
Summary: NA
Test Plan: NA
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -5,9 +5,11 @@ Comm is the working name of this open source messaging project.\n## Repo structure\nThe whole project is written in Flow-typed Javascript. The code is organized in a monorepo structure using Yarn Workspaces.\n+\n- `native` contains the code for the React Native app, which supports both iOS and Android.\n- `server` contains the code for the Node/Express server.\n- `web` contains the code for the React desktop website.\n+- `landing` contains the code for the Comm landing page.\n- `lib` contains code that is shared across multiple other workspaces, including most of the Redux stack that is shared across native/web.\n## Dev environment\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] add landing workspace description to readme
Summary: NA
Test Plan: NA
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D985 |
129,191 | 09.04.2021 13:51:41 | -7,200 | a2c06ce607c9ebfc81aa2dac0ed7787b00237335 | [server] Make source message unique
Test Plan: Run the script. Try to create two threads with the same source_message and check if an error was returned.
Reviewers: ashoat
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "server/src/scripts/create-db.js",
"new_path": "server/src/scripts/create-db.js",
"diff": "@@ -155,7 +155,7 @@ async function createTables() {\ncreator bigint(20) NOT NULL,\ncreation_time bigint(20) NOT NULL,\ncolor char(6) COLLATE utf8mb4_bin NOT NULL,\n- source_message bigint(20) DEFAULT NULL,\n+ source_message bigint(20) DEFAULT NULL UNIQUE,\nreplies_count int UNSIGNED NOT NULL DEFAULT 0\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/scripts/make-source-message-unique.js",
"diff": "+// @flow\n+\n+import { dbQuery, SQL } from '../database/database';\n+import { main } from './utils';\n+\n+async function makeSourceMessageUnique() {\n+ await dbQuery(SQL`\n+ ALTER TABLE threads\n+ ADD UNIQUE (source_message)\n+ `);\n+}\n+\n+main([makeSourceMessageUnique]);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Make source message unique
Test Plan: Run the script. Try to create two threads with the same source_message and check if an error was returned.
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1001 |
129,183 | 12.04.2021 15:24:54 | -7,200 | b1db072216243538255ee1fd4a33d5328533e1af | [web] Allow nullable threadID in useOnClickThread
Summary: I need this for next diff, context [[ | here ]]
Test Plan: Flow, tested with next diffs
Reviewers: palys-swm, ashoat
Subscribers: ashoat, palys-swm, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "web/selectors/nav-selectors.js",
"new_path": "web/selectors/nav-selectors.js",
"diff": "@@ -124,10 +124,14 @@ const nonThreadCalendarQuery: (\n},\n);\n-function useOnClickThread(threadID: string) {\n+function useOnClickThread(threadID: ?string) {\nconst dispatch = useDispatch();\nreturn React.useCallback(\n- (event: SyntheticEvent<HTMLAnchorElement>) => {\n+ (event: SyntheticEvent<HTMLElement>) => {\n+ invariant(\n+ threadID,\n+ 'useOnClickThread should be called with threadID set',\n+ );\nevent.preventDefault();\ndispatch({\ntype: updateNavInfoActionType,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Allow nullable threadID in useOnClickThread
Summary: I need this for next diff, context [[ https://phabricator.ashoat.com/D995#inline-5473 | here ]]
Test Plan: Flow, tested with next diffs
Reviewers: palys-swm, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D996 |
129,184 | 16.04.2021 12:27:20 | 14,400 | 5ed34fe28f04c511c7756797cfa95c45dfed0b1b | [landing] Add copy to landing page
Summary: NA
Test Plan: NA
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.css",
"new_path": "landing/landing.css",
"diff": "@@ -2,10 +2,16 @@ html {\noverflow: hidden;\nheight: 100%;\nbackground: radial-gradient(ellipse at bottom, #374151, #111827);\n-}\n-\n-h1 {\nfont-family: 'IBM Plex Sans', sans-serif;\ncolor: white;\n- font-size: 28px;\n+}\n+\n+h1,\n+h2 {\n+ font-family: 'IBM Plex Mono', monospace;\n+}\n+\n+canvas.particles {\n+ position: fixed;\n+ z-index: -1;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "import * as React from 'react';\nimport Particles from 'react-particles-js';\n-import './landing.css';\n+import css from './landing.css';\nimport particlesConfig from './particles-config.json';\nfunction Landing(): React.Node {\nreturn (\n<div>\n+ <Particles canvasClassName={css.particles} params={particlesConfig} />\n<h1>Comm</h1>\n- <Particles height=\"100vh\" width=\"100vw\" params={particlesConfig} />\n+ <div>\n+ <h1>Reclaim your digital identity.</h1>\n+ <p>\n+ The internet is broken today. Private user data is owned by\n+ mega-corporations and farmed for their benefit.\n+ </p>\n+ <p>\n+ E2E encryption has the potential to change this equation. But\n+ it's constrained by a crucial limitation.\n+ </p>\n+ </div>\n+\n+ <div>\n+ <h2>Apps need servers.</h2>\n+ <p>\n+ Sophisticated applications rely on servers to do things that your\n+ devices simply can't.\n+ </p>\n+ <p>\n+ That's why E2E encryption only works for simple chat apps today.\n+ There's no way to build a robust server layer that has access to\n+ your data without leaking that data to corporations.\n+ </p>\n+ </div>\n+\n+ <div>\n+ <h2>Comm is the keyserver company.</h2>\n+ <p>In the future, people have their own servers.</p>\n+ <p>\n+ Your keyserver is the home of your digital identity. It owns your\n+ private keys and your personal data. It's your password manager,\n+ your crypto wallet, your digital surrogate, and your second brain.\n+ </p>\n+ </div>\n</div>\n);\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Add copy to landing page
Summary: NA
Test Plan: NA
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1012 |
129,184 | 19.04.2021 17:07:08 | 14,400 | e707969d113d088a34e24b12c1484599211fd6ee | [landing] Particles.js configuration tweak
Summary: NA
Test Plan: NA
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/particles-config.json",
"new_path": "landing/particles-config.json",
"diff": "},\n\"move\": {\n\"enable\": true,\n- \"speed\": 1.5,\n+ \"speed\": 0.75,\n\"direction\": \"top\",\n\"random\": false,\n\"straight\": true,\n\"bounce\": false,\n\"attract\": {\n\"enable\": false,\n- \"rotateX\": 600,\n- \"rotateY\": 600\n+ \"rotateX\": 0,\n+ \"rotateY\": 0\n}\n}\n},\n\"detect_on\": \"canvas\",\n\"events\": {\n\"onhover\": {\n- \"enable\": true,\n+ \"enable\": false,\n\"mode\": \"grab\"\n},\n\"resize\": true\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Particles.js configuration tweak
Summary: NA
Test Plan: NA
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1013 |
129,183 | 09.04.2021 11:46:29 | -7,200 | c67836260c7768cd7c2b5b51a8b91047c318ec39 | [web] Rename replyTooltip to replyButton
Summary: Part of refactoring done with tooltipMenu introduction: reply is not a tooltip, but rather button
Test Plan: Flow, check if reply is still possible
Reviewers: palys-swm, ashoat
Subscribers: ashoat, palys-swm, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -215,7 +215,7 @@ div.nonViewerMessageActionLinks {\ndiv.messageActionLinks > div + div {\nmargin-left: 4px;\n}\n-div.messageReplyTooltip {\n+div.messageReplyButton {\nfont-size: 14px;\n}\ndiv.messageSidebarTooltip {\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/composed-message.react.js",
"new_path": "web/chat/composed-message.react.js",
"diff": "@@ -19,7 +19,7 @@ import { type InputState, InputStateContext } from '../input/input-state';\nimport css from './chat-message-list.css';\nimport FailedSend from './failed-send.react';\nimport { InlineSidebar } from './inline-sidebar.react';\n-import MessageReplyTooltip from './message-reply-tooltip.react';\n+import MessageReplyButton from './message-reply-button.react';\nimport {\ntype OnMessagePositionWithContainerInfo,\ntype MessagePositionInfo,\n@@ -122,7 +122,7 @@ class ComposedMessage extends React.PureComponent<Props> {\n);\n}\n- let replyTooltip;\n+ let replyButton;\nif (\nthis.props.mouseOverMessagePosition &&\nthis.props.mouseOverMessagePosition.item.messageInfo.id === id &&\n@@ -130,8 +130,8 @@ class ComposedMessage extends React.PureComponent<Props> {\n) {\nconst { inputState } = this.props;\ninvariant(inputState, 'inputState should be set in ComposedMessage');\n- replyTooltip = (\n- <MessageReplyTooltip\n+ replyButton = (\n+ <MessageReplyButton\nmessagePositionInfo={this.props.mouseOverMessagePosition}\nonReplyClick={this.onMouseLeave}\ninputState={inputState}\n@@ -163,7 +163,7 @@ class ComposedMessage extends React.PureComponent<Props> {\n}\nlet viewerActionLinks, nonViewerActionLinks;\n- if (isViewer && (replyTooltip || messageActionTooltip)) {\n+ if (isViewer && (replyButton || messageActionTooltip)) {\nviewerActionLinks = (\n<div\nclassName={classNames(\n@@ -172,10 +172,10 @@ class ComposedMessage extends React.PureComponent<Props> {\n)}\n>\n{messageActionTooltip}\n- {replyTooltip}\n+ {replyButton}\n</div>\n);\n- } else if (replyTooltip || messageActionTooltip) {\n+ } else if (replyButton || messageActionTooltip) {\nnonViewerActionLinks = (\n<div\nclassName={classNames(\n@@ -183,7 +183,7 @@ class ComposedMessage extends React.PureComponent<Props> {\ncss.nonViewerMessageActionLinks,\n)}\n>\n- {replyTooltip}\n+ {replyButton}\n{messageActionTooltip}\n</div>\n);\n"
},
{
"change_type": "RENAME",
"old_path": "web/chat/message-reply-tooltip.react.js",
"new_path": "web/chat/message-reply-button.react.js",
"diff": "@@ -17,7 +17,7 @@ type Props = {|\n+onReplyClick: () => void,\n+inputState: InputState,\n|};\n-function MessageReplyTooltip(props: Props) {\n+function MessageReplyButton(props: Props) {\nconst { inputState, onReplyClick, messagePositionInfo } = props;\nconst { addReply } = inputState;\n@@ -29,13 +29,14 @@ function MessageReplyTooltip(props: Props) {\n}, [addReply, item, onReplyClick]);\nconst { isViewer } = item.messageInfo.creator;\n- const replyTooltipClassName = classNames({\n- [css.messageReplyTooltip]: true,\n+ const replyButtonClassName = classNames({\n+ [css.messageReplyButton]: true,\n[css.tooltipRightPadding]: isViewer,\n[css.tooltipLeftPadding]: !isViewer,\n});\n+\nreturn (\n- <div className={replyTooltipClassName}>\n+ <div className={replyButtonClassName}>\n<div className={css.messageTooltipIcon} onClick={replyClicked}>\n<FontAwesomeIcon icon={faReply} />\n</div>\n@@ -43,4 +44,4 @@ function MessageReplyTooltip(props: Props) {\n);\n}\n-export default MessageReplyTooltip;\n+export default MessageReplyButton;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Rename replyTooltip to replyButton
Summary: Part of refactoring done with tooltipMenu introduction: reply is not a tooltip, but rather button
Test Plan: Flow, check if reply is still possible
Reviewers: palys-swm, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D992 |
129,183 | 09.04.2021 12:19:23 | -7,200 | ce12f74c0e9e6470141673dc30ac54815b86bb3e | [web] Rename sidebarTooltip to messageActionTooltip
Summary: Part of refactoring done with tooltipMenu introduction: `sidebarTooltip` can be used not only for sidebars action
Test Plan: Flow, check if tooltip looks and works as before
Reviewers: palys-swm, ashoat
Subscribers: ashoat, palys-swm, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -218,7 +218,7 @@ div.messageActionLinks > div + div {\ndiv.messageReplyButton {\nfont-size: 14px;\n}\n-div.messageSidebarTooltip {\n+div.messageActionButton {\nfont-size: 16px;\n}\n@@ -452,48 +452,48 @@ svg.inlineSidebarIcon {\ncolor: #666666;\n}\n-div.menuSidebarExtraAreaTop:before {\n+div.messageActionExtraAreaTop:before {\nheight: 15px;\nwidth: 55px;\ncontent: '';\nposition: absolute;\nbottom: -15px;\n}\n-div.menuSidebarExtraAreaTopRight:before {\n+div.messageActionExtraAreaTopRight:before {\nright: 0;\n}\n-div.menuSidebarExtraAreaTopLeft:before {\n+div.messageActionExtraAreaTopLeft:before {\nleft: 0;\n}\n-div.menuSidebarExtraArea:before {\n+div.messageActionExtraArea:before {\nheight: 30px;\nwidth: 20px;\ncontent: '';\nposition: absolute;\n}\n-div.menuSidebarExtraAreaRight:before {\n+div.messageActionExtraAreaRight:before {\nleft: -20px;\n}\n-div.menuSidebarExtraAreaLeft:before {\n+div.messageActionExtraAreaLeft:before {\nright: -20px;\n}\n-div.menuSidebarTopRightTooltip {\n+div.messageActionTopRightTooltip {\nbottom: 100%;\nmargin-bottom: 1px;\nright: 0;\n}\n-div.menuSidebarTopLeftTooltip {\n+div.messageActionTopLeftTooltip {\nbottom: 100%;\nmargin-bottom: 1px;\nleft: 0;\n}\n-div.menuSidebarLeftTooltip {\n+div.messageActionLeftTooltip {\ntop: 50%;\nright: 100%;\nmargin-right: 7px;\n}\n-div.menuSidebarRightTooltip {\n+div.messageActionRightTooltip {\ntop: 50%;\nleft: 100%;\nmargin-left: 7px;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/composed-message.react.js",
"new_path": "web/chat/composed-message.react.js",
"diff": "@@ -19,12 +19,12 @@ import { type InputState, InputStateContext } from '../input/input-state';\nimport css from './chat-message-list.css';\nimport FailedSend from './failed-send.react';\nimport { InlineSidebar } from './inline-sidebar.react';\n+import MessageActionButton from './message-action-button';\nimport MessageReplyButton from './message-reply-button.react';\nimport {\ntype OnMessagePositionWithContainerInfo,\ntype MessagePositionInfo,\n} from './position-types';\n-import MessageActionTooltip from './sidebar-tooltip.react';\nimport { tooltipPositions } from './tooltip-utils';\nconst availableTooltipPositionsForViewerMessage = [\n@@ -139,7 +139,7 @@ class ComposedMessage extends React.PureComponent<Props> {\n);\n}\n- let messageActionTooltip;\n+ let messageActionButton;\nif (\nthis.props.mouseOverMessagePosition &&\nthis.props.mouseOverMessagePosition.item.messageInfo.id === id &&\n@@ -149,8 +149,8 @@ class ComposedMessage extends React.PureComponent<Props> {\n? availableTooltipPositionsForViewerMessage\n: availableTooltipPositionsForNonViewerMessage;\n- messageActionTooltip = (\n- <MessageActionTooltip\n+ messageActionButton = (\n+ <MessageActionButton\nthreadInfo={threadInfo}\nitem={item}\nonLeave={this.onMouseLeave}\n@@ -163,7 +163,7 @@ class ComposedMessage extends React.PureComponent<Props> {\n}\nlet viewerActionLinks, nonViewerActionLinks;\n- if (isViewer && (replyButton || messageActionTooltip)) {\n+ if (isViewer && (replyButton || messageActionButton)) {\nviewerActionLinks = (\n<div\nclassName={classNames(\n@@ -171,11 +171,11 @@ class ComposedMessage extends React.PureComponent<Props> {\ncss.viewerMessageActionLinks,\n)}\n>\n- {messageActionTooltip}\n+ {messageActionButton}\n{replyButton}\n</div>\n);\n- } else if (replyButton || messageActionTooltip) {\n+ } else if (replyButton || messageActionButton) {\nnonViewerActionLinks = (\n<div\nclassName={classNames(\n@@ -184,7 +184,7 @@ class ComposedMessage extends React.PureComponent<Props> {\n)}\n>\n{replyButton}\n- {messageActionTooltip}\n+ {messageActionButton}\n</div>\n);\n}\n"
},
{
"change_type": "RENAME",
"old_path": "web/chat/sidebar-tooltip.react.js",
"new_path": "web/chat/message-action-button.js",
"diff": "@@ -34,7 +34,7 @@ type Props = {|\n+containerPosition: PositionInfo,\n+availableTooltipPositions: $ReadOnlyArray<TooltipPosition>,\n|};\n-function SidebarTooltipButton(props: Props) {\n+function MessageActionMenu(props: Props) {\nconst {\nonLeave,\nonButtonClick,\n@@ -45,7 +45,7 @@ function SidebarTooltipButton(props: Props) {\nconst [tooltipVisible, setTooltipVisible] = React.useState(false);\nconst [pointingTo, setPointingTo] = React.useState();\n- const toggleMenu = React.useCallback(\n+ const toggleTooltip = React.useCallback(\n(event: SyntheticEvent<HTMLDivElement>) => {\nsetTooltipVisible(!tooltipVisible);\nif (tooltipVisible) {\n@@ -74,7 +74,7 @@ function SidebarTooltipButton(props: Props) {\n[containerPosition, tooltipVisible],\n);\n- const toggleSidebar = React.useCallback(\n+ const onTooltipButtonClick = React.useCallback(\n(event: SyntheticEvent<HTMLButtonElement>) => {\nonButtonClick(event);\nonLeave();\n@@ -82,7 +82,7 @@ function SidebarTooltipButton(props: Props) {\n[onLeave, onButtonClick],\n);\n- const hideMenu = React.useCallback(() => {\n+ const hideTooltip = React.useCallback(() => {\nsetTooltipVisible(false);\n}, []);\n@@ -93,19 +93,19 @@ function SidebarTooltipButton(props: Props) {\navailableTooltipPositions={availableTooltipPositions}\ntargetPositionInfo={pointingTo}\nlayoutPosition=\"relative\"\n- getStyle={getSidebarTooltipStyle}\n+ getStyle={getMessageActionTooltipStyle}\n>\n- <TooltipButton text={buttonText} onClick={toggleSidebar} />\n+ <TooltipButton text={buttonText} onClick={onTooltipButtonClick} />\n</TooltipMenu>\n);\n}\nreturn (\n- <div className={css.messageSidebarTooltip}>\n+ <div className={css.messageActionButton}>\n<div\nclassName={css.messageTooltipIcon}\n- onMouseLeave={hideMenu}\n- onClick={toggleMenu}\n+ onMouseLeave={hideTooltip}\n+ onClick={toggleTooltip}\n>\n<FontAwesomeIcon icon={faEllipsisH} />\n{tooltipMenu}\n@@ -131,7 +131,7 @@ function OpenSidebar(props: OpenSidebarProps) {\nconst onButtonClick = useOnClickThread(threadCreatedFromMessage.id);\nreturn (\n- <SidebarTooltipButton\n+ <MessageActionMenu\nonButtonClick={onButtonClick}\nonLeave={onLeave}\nbuttonText={openSidebarText}\n@@ -159,7 +159,7 @@ function CreateSidebar(props: CreateSidebarProps) {\nconst onButtonClick = useOnClickPendingSidebar(messageInfo, threadInfo);\nreturn (\n- <SidebarTooltipButton\n+ <MessageActionMenu\nonButtonClick={onButtonClick}\nonLeave={props.onLeave}\nbuttonText={createSidebarText}\n@@ -176,7 +176,7 @@ type MessageActionTooltipProps = {|\n+containerPosition: PositionInfo,\n+availableTooltipPositions: $ReadOnlyArray<TooltipPosition>,\n|};\n-function MessageActionTooltip(props: MessageActionTooltipProps) {\n+function MessageActionButton(props: MessageActionTooltipProps) {\nconst {\nthreadInfo,\nitem,\n@@ -206,42 +206,42 @@ function MessageActionTooltip(props: MessageActionTooltipProps) {\n}\n}\n-function getSidebarTooltipStyle(\n+function getMessageActionTooltipStyle(\ntooltipPosition: TooltipPosition,\n): TooltipStyle {\nlet className;\nif (tooltipPosition === tooltipPositions.TOP_RIGHT) {\nclassName = classNames(\n- css.menuSidebarTopRightTooltip,\n+ css.messageActionTopRightTooltip,\ncss.messageTopRightTooltip,\n- css.menuSidebarExtraAreaTop,\n- css.menuSidebarExtraAreaTopRight,\n+ css.messageActionExtraAreaTop,\n+ css.messageActionExtraAreaTopRight,\n);\n} else if (tooltipPosition === tooltipPositions.TOP_LEFT) {\nclassName = classNames(\n- css.menuSidebarTopLeftTooltip,\n+ css.messageActionTopLeftTooltip,\ncss.messageTopLeftTooltip,\n- css.menuSidebarExtraAreaTop,\n- css.menuSidebarExtraAreaTopLeft,\n+ css.messageActionExtraAreaTop,\n+ css.messageActionExtraAreaTopLeft,\n);\n} else if (tooltipPosition === tooltipPositions.RIGHT) {\nclassName = classNames(\n- css.menuSidebarRightTooltip,\n+ css.messageActionRightTooltip,\ncss.messageRightTooltip,\n- css.menuSidebarExtraArea,\n- css.menuSidebarExtraAreaRight,\n+ css.messageActionExtraArea,\n+ css.messageActionExtraAreaRight,\n);\n} else if (tooltipPosition === tooltipPositions.LEFT) {\nclassName = classNames(\n- css.menuSidebarLeftTooltip,\n+ css.messageActionLeftTooltip,\ncss.messageLeftTooltip,\n- css.menuSidebarExtraArea,\n- css.menuSidebarExtraAreaLeft,\n+ css.messageActionExtraArea,\n+ css.messageActionExtraAreaLeft,\n);\n}\n- invariant(className, `${tooltipPosition} is not valid for sidebar tooltip`);\n+ invariant(className, `${tooltipPosition} is not valid for message tooltip`);\nreturn { className };\n}\n-export default MessageActionTooltip;\n+export default MessageActionButton;\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/robotext-message.react.js",
"new_path": "web/chat/robotext-message.react.js",
"diff": "@@ -17,11 +17,11 @@ import { useSelector } from '../redux/redux-utils';\nimport { updateNavInfoActionType } from '../types/nav-types';\nimport css from './chat-message-list.css';\nimport { InlineSidebar } from './inline-sidebar.react';\n+import MessageActionTooltip from './message-action-button';\nimport type {\nMessagePositionInfo,\nOnMessagePositionWithContainerInfo,\n} from './position-types';\n-import MessageActionTooltip from './sidebar-tooltip.react';\nimport { tooltipPositions } from './tooltip-utils';\nconst availableTooltipPositionsForRobotext = [\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Rename sidebarTooltip to messageActionTooltip
Summary: Part of refactoring done with tooltipMenu introduction: `sidebarTooltip` can be used not only for sidebars action
Test Plan: Flow, check if tooltip looks and works as before
Reviewers: palys-swm, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D993 |
129,183 | 09.04.2021 12:23:52 | -7,200 | 378ef4bf288eb263818e96338b96465585557448 | [web] Rename messageTooltipIcon to messageActionLinkIcon
Summary: Change of names used in reply and action button for messages to be clear what we call 'tooltip'
Test Plan: Flow, check if visually nothing changed
Reviewers: palys-swm, ashoat
Subscribers: ashoat, palys-swm, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-message-list.css",
"new_path": "web/chat/chat-message-list.css",
"diff": "@@ -222,11 +222,11 @@ div.messageActionButton {\nfont-size: 16px;\n}\n-div.messageTooltipIcon {\n+div.messageActionLinkIcon {\npadding: 2px 3px;\nposition: relative;\n}\n-div.messageTooltipIcon:hover {\n+div.messageActionLinkIcon:hover {\ncursor: pointer;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/message-action-button.js",
"new_path": "web/chat/message-action-button.js",
"diff": "@@ -103,7 +103,7 @@ function MessageActionMenu(props: Props) {\nreturn (\n<div className={css.messageActionButton}>\n<div\n- className={css.messageTooltipIcon}\n+ className={css.messageActionLinkIcon}\nonMouseLeave={hideTooltip}\nonClick={toggleTooltip}\n>\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/message-reply-button.react.js",
"new_path": "web/chat/message-reply-button.react.js",
"diff": "@@ -37,7 +37,7 @@ function MessageReplyButton(props: Props) {\nreturn (\n<div className={replyButtonClassName}>\n- <div className={css.messageTooltipIcon} onClick={replyClicked}>\n+ <div className={css.messageActionLinkIcon} onClick={replyClicked}>\n<FontAwesomeIcon icon={faReply} />\n</div>\n</div>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Rename messageTooltipIcon to messageActionLinkIcon
Summary: Change of names used in reply and action button for messages to be clear what we call 'tooltip'
Test Plan: Flow, check if visually nothing changed
Reviewers: palys-swm, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D994 |
129,187 | 14.04.2021 13:13:49 | 14,400 | 57588fae748567e0d73e5a85dd2eb536d14e8caf | [web] Don't show Privacy tab in ThreadSettingsModal for sidebars
Summary: More accurately: for threads created as sidebars. More context [here](https://phabricator.ashoat.com/D1000?id=3007#inline-5622).
Test Plan: Check `ThreadSettingsModal` for a thread created as a sidebar
Reviewers: KatPo, palys-swm
Subscribers: Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "web/modals/threads/thread-settings-modal.react.js",
"new_path": "web/modals/threads/thread-settings-modal.react.js",
"diff": "@@ -338,7 +338,16 @@ class ThreadSettingsModal extends React.PureComponent<Props, State> {\nkey=\"general\"\n/>,\n];\n- if (this.possiblyChangedValue('parentThreadID')) {\n+\n+ // This UI needs to be updated to handle sidebars but we haven't gotten\n+ // there yet. We'll probably end up ripping it out anyways, so for now we\n+ // are just hiding the privacy tab for any thread that was created as a\n+ // sidebar\n+ const canSeePrivacyTab =\n+ this.possiblyChangedValue('parentThreadID') &&\n+ !this.props.threadInfo.sourceMessageID;\n+\n+ if (canSeePrivacyTab) {\ntabs.push(\n<Tab\nname=\"Privacy\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [web] Don't show Privacy tab in ThreadSettingsModal for sidebars
Summary: More accurately: for threads created as sidebars. More context [here](https://phabricator.ashoat.com/D1000?id=3007#inline-5622).
Test Plan: Check `ThreadSettingsModal` for a thread created as a sidebar
Reviewers: KatPo, palys-swm
Reviewed By: KatPo, palys-swm
Subscribers: Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1007 |
129,187 | 14.04.2021 23:39:14 | 14,400 | 9f08352bca5c5b675a4b0441bd63f7c8fb03f607 | [server] Get rid of unused MembershipRowToSave.subscription parameter
Summary: This isn't used anywhere so I'm getting rid of it to make the code simpler.
Test Plan: Flow
Reviewers: palys-swm
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/thread-permission-updaters.js",
"new_path": "server/src/updaters/thread-permission-updaters.js",
"diff": "@@ -9,7 +9,6 @@ import {\nmakePermissionsForChildrenBlob,\n} from 'lib/permissions/thread-permissions';\nimport type { CalendarQuery } from 'lib/types/entry-types';\n-import type { ThreadSubscription } from 'lib/types/subscription-types';\nimport {\ntype ThreadPermissionsBlob,\ntype ThreadRolePermissionsBlob,\n@@ -47,7 +46,6 @@ export type MembershipRowToSave = {|\n+permissionsForChildren: ?ThreadPermissionsBlob,\n// null role represents by \"0\"\n+role: string,\n- +subscription?: ThreadSubscription,\nlastMessage?: number,\nlastReadMessage?: number,\n|};\n@@ -489,14 +487,6 @@ async function saveMemberships(toSave: $ReadOnlyArray<MembershipRowToSave>) {\nconst time = Date.now();\nconst insertRows = [];\nfor (const rowToSave of toSave) {\n- let subscription;\n- if (rowToSave.subscription) {\n- subscription = JSON.stringify(rowToSave.subscription);\n- } else if (rowToSave.operation === 'join') {\n- subscription = joinSubscriptionString;\n- } else {\n- subscription = defaultSubscriptionString;\n- }\nconst lastMessage = rowToSave.lastMessage ?? 0;\nconst lastReadMessage = rowToSave.lastReadMessage ?? 0;\ninsertRows.push([\n@@ -504,7 +494,9 @@ async function saveMemberships(toSave: $ReadOnlyArray<MembershipRowToSave>) {\nrowToSave.threadID,\nrowToSave.role,\ntime,\n- subscription,\n+ rowToSave.operation === 'join'\n+ ? joinSubscriptionString\n+ : defaultSubscriptionString,\nrowToSave.permissions ? JSON.stringify(rowToSave.permissions) : null,\nrowToSave.permissionsForChildren\n? JSON.stringify(rowToSave.permissionsForChildren)\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Get rid of unused MembershipRowToSave.subscription parameter
Summary: This isn't used anywhere so I'm getting rid of it to make the code simpler.
Test Plan: Flow
Reviewers: palys-swm
Reviewed By: palys-swm
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1022 |
129,187 | 19.04.2021 18:07:14 | 14,400 | b084cd806e337c65a15d36e6b91fd9fb4401c5dc | [server] Migration to update sidebars to depend on parent for KNOW_OF
Summary: This migration updates the database to reflect D1020
Test Plan: Run the migration and make sure the output looks good and the database looks right
Reviewers: palys-swm
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/scripts/sidebar-know-of-migration.js",
"diff": "+// @flow\n+\n+import bots from 'lib/facts/bots.json';\n+import { threadTypes, type ThreadType } from 'lib/types/thread-types';\n+\n+import { dbQuery, SQL } from '../database/database';\n+import { createScriptViewer } from '../session/scripts';\n+import { updateRoles } from '../updaters/role-updaters';\n+import {\n+ recalculateThreadPermissions,\n+ commitMembershipChangeset,\n+} from '../updaters/thread-permission-updaters';\n+import RelationshipChangeset from '../utils/relationship-changeset';\n+import { main } from './utils';\n+\n+async function updatePrivateThreads() {\n+ console.log('updating private threads');\n+ await updateThreads(threadTypes.PRIVATE);\n+}\n+\n+async function updateSidebars() {\n+ console.log('updating sidebars');\n+ await updateThreads(threadTypes.SIDEBAR);\n+}\n+\n+const batchSize = 10;\n+\n+async function updateThreads(threadType: ThreadType) {\n+ const fetchThreads = SQL`\n+ SELECT id FROM threads WHERE type = ${threadType}\n+ `;\n+ const [result] = await dbQuery(fetchThreads);\n+ const threadIDs = result.map((row) => row.id.toString());\n+\n+ const viewer = createScriptViewer(bots.squadbot.userID);\n+ while (threadIDs.length > 0) {\n+ const batch = threadIDs.splice(0, batchSize);\n+ const membershipRows = [];\n+ const relationshipChangeset = new RelationshipChangeset();\n+ await Promise.all(\n+ batch.map(async (threadID) => {\n+ console.log(`updating roles for ${threadID}`);\n+ await updateRoles(viewer, threadID, threadType);\n+ console.log(`recalculating permissions for ${threadID}`);\n+ const {\n+ membershipRows: threadMembershipRows,\n+ relationshipChangeset: threadRelationshipChangeset,\n+ } = await recalculateThreadPermissions(threadID, threadType);\n+ membershipRows.push(...threadMembershipRows);\n+ relationshipChangeset.addAll(threadRelationshipChangeset);\n+ }),\n+ );\n+ console.log(`committing batch ${JSON.stringify(batch)}`);\n+ await commitMembershipChangeset(viewer, {\n+ membershipRows,\n+ relationshipChangeset,\n+ });\n+ }\n+}\n+\n+// This migration is supposed to update the database to reflect\n+// https://phabricator.ashoat.com/D1020. There are two changes there:\n+// (1) Changes to SIDEBAR so membership no longer automatically confers KNOW_OF\n+// (2) Changes to PRIVATE so all of its children have KNOW_OF\n+// We want to apply the changes to PRIVATE first so that when we recalculate\n+// the permissions for any of a PRIVATE thread's SIDEBARs, the parent has\n+// already been updated.\n+main([updatePrivateThreads, updateSidebars]);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Migration to update sidebars to depend on parent for KNOW_OF
Summary: This migration updates the database to reflect D1020
Test Plan: Run the migration and make sure the output looks good and the database looks right
Reviewers: palys-swm
Reviewed By: palys-swm
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1029 |
129,191 | 19.04.2021 18:01:11 | -7,200 | 00bf4afecdb63116a13cd8e9c58804bdc28c0cd8 | [lib] Change generatePendingThreadColor to accept only an array
Test Plan: Login on two devices as different users. Search for a pending thread with both users and one another. Check if thread color is the same on both devices.
Reviewers: ashoat
Subscribers: ashoat, KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/thread-utils.js",
"new_path": "lib/shared/thread-utils.js",
"diff": "@@ -79,11 +79,8 @@ function generateRandomColor() {\nreturn color;\n}\n-function generatePendingThreadColor(\n- userIDs: $ReadOnlyArray<string>,\n- viewerID: string,\n-) {\n- const ids = [...userIDs, viewerID].sort().join('#');\n+function generatePendingThreadColor(userIDs: $ReadOnlyArray<string>) {\n+ const ids = [...userIDs].sort().join('#');\nlet hash = 0;\nfor (let i = 0; i < ids.length; i++) {\n@@ -301,7 +298,7 @@ function createPendingThread({\ntype: threadType,\nname: name ?? null,\ndescription: null,\n- color: threadColor ?? generatePendingThreadColor(memberIDs, viewerID),\n+ color: threadColor ?? generatePendingThreadColor([...memberIDs, viewerID]),\ncreationTime: now,\nparentThreadID: parentThreadID ?? null,\nmembers: [\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/creators/thread-creator.js",
"new_path": "server/src/creators/thread-creator.js",
"diff": "@@ -223,10 +223,10 @@ async function createThread(\n? request.color.toLowerCase()\n: generateRandomColor();\nif (threadType === threadTypes.PERSONAL) {\n- color = generatePendingThreadColor(\n- request.initialMemberIDs ?? [],\n+ color = generatePendingThreadColor([\n+ ...(request.initialMemberIDs ?? []),\nviewer.id,\n- );\n+ ]);\n}\nconst time = Date.now();\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Change generatePendingThreadColor to accept only an array
Test Plan: Login on two devices as different users. Search for a pending thread with both users and one another. Check if thread color is the same on both devices.
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: ashoat, KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1033 |
129,191 | 20.04.2021 16:02:34 | -7,200 | 8b25f351525a3d086c2f3d163a7a1fedeb48734e | [lib] Introduce pending thread creation map
Test Plan: Create real thread from pending thread
Reviewers: ashoat
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/input/input-state-container.react.js",
"new_path": "native/input/input-state-container.react.js",
"diff": "@@ -129,6 +129,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nsendCallbacks: Array<() => void> = [];\nactiveURIs = new Map();\nreplyCallbacks: Array<(message: string) => void> = [];\n+ pendingThreadCreations = new Map<string, Promise<?string>>();\nstatic getCompletedUploads(props: Props, state: State): CompletedUploads {\nconst completedUploads = {};\n@@ -339,18 +340,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\npayload: messageInfo,\n});\n- let newThreadID;\n- try {\n- newThreadID = await createRealThreadFromPendingThread({\n- threadInfo,\n- dispatchActionPromise: this.props.dispatchActionPromise,\n- createNewThread: this.props.newThread,\n- sourceMessageID: threadInfo.sourceMessageID,\n- viewerID: this.props.viewerID,\n- });\n- } catch (e) {\n- newThreadID = undefined;\n- }\n+ const newThreadID = await this.createRealizedThread(threadInfo);\nif (!newThreadID) {\nthis.props.dispatch({\ntype: sendTextMessageActionTypes.failed,\n@@ -371,6 +361,31 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n);\n};\n+ async createRealizedThread(threadInfo: ThreadInfo): Promise<?string> {\n+ try {\n+ let threadCreationPromise = this.pendingThreadCreations.get(\n+ threadInfo.id,\n+ );\n+ if (!threadCreationPromise) {\n+ threadCreationPromise = createRealThreadFromPendingThread({\n+ threadInfo,\n+ dispatchActionPromise: this.props.dispatchActionPromise,\n+ createNewThread: this.props.newThread,\n+ sourceMessageID: threadInfo.sourceMessageID,\n+ viewerID: this.props.viewerID,\n+ });\n+ this.pendingThreadCreations.set(threadInfo.id, threadCreationPromise);\n+ }\n+ return await threadCreationPromise;\n+ } catch (e) {\n+ return undefined;\n+ } finally {\n+ // The promise is settled so we can clean the map to avoid a memory leak\n+ // and allow retries\n+ this.pendingThreadCreations.delete(threadInfo.id);\n+ }\n+ }\n+\nasync sendTextMessageAction(\nmessageInfo: RawTextMessageInfo,\n): Promise<SendMessagePayload> {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Introduce pending thread creation map
Test Plan: Create real thread from pending thread
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1034 |
129,184 | 19.04.2021 17:55:18 | 14,400 | cd1968d1808952bebf52dde685cac55721cbbf79 | [landing] Two-column CSS Grid
Summary: Naive two-column CSS Grid layout, will be fleshed out in subsequent diffs
Test Plan: NA
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.css",
"new_path": "landing/landing.css",
"diff": "@@ -10,18 +10,47 @@ h2 {\nfont-family: 'IBM Plex Mono', monospace;\n}\n-div.hero {\n+div.grid {\n+ display: grid;\n+ padding: 80px;\n+ row-gap: 18em;\n+ grid-template-columns: 1fr 1fr;\n+ grid-template-areas:\n+ 'hero_copy hero_image'\n+ 'server_copy server_image'\n+ 'keyserver_copy read_the_docs';\n+}\n+\n+div.hero_copy {\n+ grid-area: hero_copy;\n+}\n+\n+div.hero_image {\n+ grid-area: hero_image;\nbackground-image: url(../images/hero_illustration.svg);\nwidth: 600px;\nheight: 600px;\n}\n-div.server {\n+div.server_copy {\n+ grid-area: server_copy;\n+}\n+\n+div.server_image {\n+ grid-area: server_image;\nbackground-image: url(../images/server_illustration.svg);\nwidth: 617px;\nheight: 535px;\n}\n+div.keyserver_copy {\n+ grid-area: keyserver_copy;\n+}\n+\n+div.read_the_docs {\n+ grid-area: read_the_docs;\n+}\n+\ncanvas.particles {\nposition: fixed;\nz-index: -1;\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "@@ -11,9 +11,9 @@ function Landing(): React.Node {\n<div>\n<Particles canvasClassName={css.particles} params={particlesConfig} />\n<h1>Comm</h1>\n- <div>\n- <div className={css.hero} />\n- <div>\n+ <div className={css.grid}>\n+ <div className={css.hero_image} />\n+ <div className={css.hero_copy}>\n<h1>Reclaim your digital identity.</h1>\n<p>\nThe internet is broken today. Private user data is owned by\n@@ -25,8 +25,8 @@ function Landing(): React.Node {\n</p>\n</div>\n- <div className={css.server} />\n- <div>\n+ <div className={css.server_image} />\n+ <div className={css.server_copy}>\n<h2>Apps need servers.</h2>\n<p>\nSophisticated applications rely on servers to do things that your\n@@ -39,7 +39,7 @@ function Landing(): React.Node {\n</p>\n</div>\n- <div>\n+ <div className={css.keyserver_copy}>\n<h2>Comm is the keyserver company.</h2>\n<p>In the future, people have their own servers.</p>\n<p>\n@@ -49,6 +49,10 @@ function Landing(): React.Node {\nbrain.\n</p>\n</div>\n+\n+ <div className={css.read_the_docs}>\n+ <p>There's gonna be a button here someday.</p>\n+ </div>\n</div>\n</div>\n);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Two-column CSS Grid
Summary: Naive two-column CSS Grid layout, will be fleshed out in subsequent diffs
Test Plan: NA
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1030 |
129,184 | 19.04.2021 18:39:47 | 14,400 | af879019739ecbc518e2a4e1aad314263ad59a78 | [landing] Text styling
Summary: Styling text based on values specified in "largest" breakpoint of Figma doc. Will consider differences at each breakpoint in later diffs.
Test Plan: NA, everything seems to look as it should on Safari/Chrome/Firefox so far
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.css",
"new_path": "landing/landing.css",
"diff": "@@ -10,10 +10,33 @@ h2 {\nfont-family: 'IBM Plex Mono', monospace;\n}\n+h1.title {\n+ font-family: 'IBM Plex Sans', sans-serif;\n+ font-size: 24px;\n+ padding-left: 80px;\n+}\n+\n+span.purple {\n+ color: #7e57c2;\n+}\n+\n+h2.lede {\n+ font-size: 80px;\n+}\n+\n+h2 {\n+ font-size: 60px;\n+}\n+\n+p {\n+ font-size: 24px;\n+}\n+\ndiv.grid {\ndisplay: grid;\npadding: 80px;\nrow-gap: 18em;\n+ column-gap: 4em;\ngrid-template-columns: 1fr 1fr;\ngrid-template-areas:\n'hero_copy hero_image'\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "@@ -10,11 +10,14 @@ function Landing(): React.Node {\nreturn (\n<div>\n<Particles canvasClassName={css.particles} params={particlesConfig} />\n- <h1>Comm</h1>\n+ <h1 className={css.title}>Comm</h1>\n<div className={css.grid}>\n<div className={css.hero_image} />\n<div className={css.hero_copy}>\n- <h1>Reclaim your digital identity.</h1>\n+ <h2 className={css.lede}>\n+ Reclaim your\n+ <span className={css.purple}> digital identity.</span>\n+ </h2>\n<p>\nThe internet is broken today. Private user data is owned by\nmega-corporations and farmed for their benefit.\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Text styling
Summary: Styling text based on values specified in "largest" breakpoint of Figma doc. Will consider differences at each breakpoint in later diffs.
Test Plan: NA, everything seems to look as it should on Safari/Chrome/Firefox so far
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1032 |
129,187 | 21.04.2021 16:30:26 | 14,400 | aa4330c2bcd7ff3d6e62a84f3e60fa4d117c110d | [native] Fix Android debug build on Android 10
Summary: See this Notion task:
Test Plan: Build it and run on Android 10
Reviewers: karol-bisztyga
Subscribers: KatPo, palys-swm, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -173,10 +173,8 @@ android {\n}\npackagingOptions {\n- pickFirst \"lib/armeabi-v7a/libc++_shared.so\"\n- pickFirst \"lib/arm64-v8a/libc++_shared.so\"\n- pickFirst \"lib/x86/libc++_shared.so\"\n- pickFirst \"lib/x86_64/libc++_shared.so\"\n+ pickFirst \"**/libc++_shared.so\"\n+ pickFirst \"**/libfbjni.so\"\n}\ndefaultConfig {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/gradle.properties",
"new_path": "native/android/gradle.properties",
"diff": "@@ -25,4 +25,4 @@ android.useAndroidX=true\nandroid.enableJetifier=true\n# Version of flipper SDK to use with React Native\n-FLIPPER_VERSION=0.54.0\n+FLIPPER_VERSION=0.78.0\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Fix Android debug build on Android 10
Summary: See this Notion task: https://www.notion.so/commapp/Android-build-insta-crashes-due-to-Flipper-dependency-b46d1aa7dde04b4185c80e1c695f4d8e
Test Plan: Build it and run on Android 10
Reviewers: karol-bisztyga
Reviewed By: karol-bisztyga
Subscribers: KatPo, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1038 |
129,190 | 15.04.2021 12:49:50 | -7,200 | 438116e0fa35913712216dede46f348fb9c76e3d | [sqlite] prepare android
Summary: add necessary code to make sqlite work on android
Test Plan: Please read [this](https://phabricator.ashoat.com/D1010)
Reviewers: palys-swm, ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/CommonCpp/DatabaseManagers/SQLiteManager.cpp",
"new_path": "native/CommonCpp/DatabaseManagers/SQLiteManager.cpp",
"diff": "@@ -5,6 +5,8 @@ namespace comm {\nSQLiteManager::SQLiteManager() {}\n+std::string SQLiteManager::sqliteFilePath;\n+\nstd::string SQLiteManager::getDraft(jsi::Runtime &rt) const {\nreturn \"working draft from SQLiteManager!\";\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/CommonCpp/DatabaseManagers/SQLiteManager.h",
"new_path": "native/CommonCpp/DatabaseManagers/SQLiteManager.h",
"diff": "#include \"DatabaseManagerInterface.h\"\n+#include <string>\n+\nnamespace comm {\nclass SQLiteManager : public DatabaseManagerInterface {\npublic:\n+ static std::string sqliteFilePath;\n+\nSQLiteManager();\n// to be removed\nstd::string getDraft(jsi::Runtime &rt) const override;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/CMakeLists.txt",
"new_path": "native/android/app/CMakeLists.txt",
"diff": "@@ -22,6 +22,8 @@ include_directories(\n../../node_modules/react-native/ReactCommon/callinvoker\n../../node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon\n../../node_modules/react-native/ReactCommon/turbomodule/core\n+ # sqlite code\n+ ../../node_modules/@nozbe/sqlite/sqlite-amalgamation-3310100\n# comm android specific code\n./src/cpp\n# comm native mutual code\n@@ -30,6 +32,7 @@ include_directories(\n)\n# search for all cpp files in this directory\n+file(GLOB SQLITE \"../../node_modules/@nozbe/sqlite/sqlite-amalgamation-3310100/*.c\")\nfile(GLOB COMMON_NATIVE_CODE \"../../CommonCpp/**/*.cpp\")\nadd_library(\n@@ -42,6 +45,7 @@ add_library(\n../../node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/CallInvokerHolder.cpp\n../../node_modules/react-native/ReactCommon/turbomodule/core/TurboModule.cpp\n./src/cpp/jsiInstaller.cpp\n+ ${SQLITE}\n# comm code\n${COMMON_NATIVE_CODE}\n)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/android/app/src/cpp/jniHelpers.h",
"diff": "+#pragma once\n+\n+#include <fbjni/fbjni.h>\n+#include <string>\n+\n+namespace comm {\n+\n+namespace jni = facebook::jni;\n+\n+struct HashMap : jni::JavaClass<\n+ HashMap,\n+ jni::JMap<jni::JString, jni::JObject>\n+> {\n+ static constexpr auto kJavaDescriptor =\n+ \"Ljava/util/HashMap;\";\n+\n+ jni::local_ref<jni::JObject> get(const std::string &key) {\n+ static auto method = getClass()->getMethod<\n+ jni::local_ref<jni::JObject>(jni::local_ref<jni::JObject>)\n+ >(\"get\");\n+ return method(self(), jni::make_jstring(key));;\n+ }\n+};\n+\n+} // namespace comm\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/cpp/jsiInstaller.cpp",
"new_path": "native/android/app/src/cpp/jsiInstaller.cpp",
"diff": "#include <fbjni/fbjni.h>\n#include <CallInvokerHolder.h>\n#include \"DraftNativeModule.h\"\n+#include \"SQLiteManager.h\"\n+#include \"jniHelpers.h\"\nnamespace jni = facebook::jni;\nnamespace jsi = facebook::jsi;\n@@ -16,19 +18,26 @@ public:\nstatic void initHybrid(\njni::alias_ref<jhybridobject> jThis,\njlong jsContext,\n- jni::alias_ref<react::CallInvokerHolder::javaobject> jsCallInvokerHolder\n+ jni::alias_ref<react::CallInvokerHolder::javaobject> jsCallInvokerHolder,\n+ comm::HashMap additionalParameters\n) {\n- jsi::Runtime *runtime = (jsi::Runtime *)jsContext;\n+ jsi::Runtime *rt = (jsi::Runtime *)jsContext;\nauto jsCallInvoker = jsCallInvokerHolder->cthis()->getCallInvoker();\nstd::shared_ptr<comm::DraftNativeModule> nativeModule =\nstd::make_shared<comm::DraftNativeModule>(jsCallInvoker);\n-\n- runtime->global().setProperty(\n- *runtime,\n- jsi::PropNameID::forAscii(*runtime, \"draftModule\"),\n- jsi::Object::createFromHostObject(*runtime, nativeModule)\n+ // patch runtime\n+ // - add draft module\n+ rt->global().setProperty(\n+ *rt,\n+ jsi::PropNameID::forAscii(*rt, \"draftModule\"),\n+ jsi::Object::createFromHostObject(*rt, nativeModule)\n);\n+\n+ // set sqlite file path\n+ jni::local_ref<jni::JObject> sqliteFilePathObj =\n+ additionalParameters.get(\"sqliteFilePath\");\n+ comm::SQLiteManager::sqliteFilePath = sqliteFilePathObj->toString();\n}\nstatic void registerNatives() {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/java/org/squadcal/MainActivity.java",
"new_path": "native/android/app/src/main/java/org/squadcal/MainActivity.java",
"diff": "@@ -14,7 +14,6 @@ import expo.modules.splashscreen.SplashScreenImageResizeMode;\nimport com.facebook.react.ReactInstanceManager;\nimport com.facebook.react.bridge.ReactContext;\n-import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;\nimport org.squadcal.fbjni.CommHybrid;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/main/java/org/squadcal/fbjni/CommHybrid.java",
"new_path": "native/android/app/src/main/java/org/squadcal/fbjni/CommHybrid.java",
"diff": "package org.squadcal.fbjni;\n+import android.content.Context;\n+\nimport com.facebook.react.bridge.ReactContext;\nimport com.facebook.react.turbomodule.core.CallInvokerHolderImpl;\n+import java.util.HashMap;\n+\npublic class CommHybrid {\n- // prevent creating an object of this class\n+\nprivate CommHybrid() {}\npublic static void initHybrid(ReactContext context) {\nCallInvokerHolderImpl holder = (CallInvokerHolderImpl)\ncontext.getCatalystInstance().getJSCallInvokerHolder();\nlong contextPointer = context.getJavaScriptContextHolder().get();\n- initHybrid(contextPointer, holder);\n+\n+ // additional parameters\n+ String sqliteFilePath = context.getDatabasePath(\"comm.sqlite\").toString();\n+ HashMap<String, Object> additionalParameters =\n+ new HashMap<String, Object>();\n+ additionalParameters.put(\"sqliteFilePath\", sqliteFilePath);\n+\n+ new CommHybrid().initHybrid(contextPointer, holder, additionalParameters);\n}\n- public static native void initHybrid(\n+\n+ public native void initHybrid(\nlong jsContextNativePointer,\n- CallInvokerHolderImpl jsCallInvokerHolder\n+ CallInvokerHolderImpl jsCallInvokerHolder,\n+ HashMap<String, Object> additionalParameters\n);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"metro-react-native-babel-preset\": \"^0.59.0\",\n\"patch-package\": \"^6.2.2\",\n\"postinstall-postinstall\": \"^2.0.0\",\n+ \"react-native-flipper\": \"^0.79.1\",\n\"react-test-renderer\": \"16.13.1\",\n\"redux-flipper\": \"^1.4.2\",\n- \"react-native-flipper\": \"^0.79.1\",\n\"remote-redux-devtools\": \"git+https://git@github.com/zalmoxisus/remote-redux-devtools.git\",\n\"remotedev\": \"git+https://git@github.com/zalmoxisus/remotedev.git\",\n\"remotedev-server\": \"^0.3.1\"\n},\n\"dependencies\": {\n+ \"@nozbe/sqlite\": \"^3.31.1\",\n\"@react-native-community/art\": \"^1.2.0\",\n\"@react-native-community/async-storage\": \"^1.6.1\",\n\"@react-native-community/clipboard\": \"^1.5.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "readdirp \"^2.2.1\"\nupath \"^1.1.1\"\n+\"@nozbe/sqlite@^3.31.1\":\n+ version \"3.31.1\"\n+ resolved \"https://registry.yarnpkg.com/@nozbe/sqlite/-/sqlite-3.31.1.tgz#ffd394ad7c188c6b73f89fd6e1ccb849a1b96dba\"\n+ integrity sha512-z5+GdcHZl9OQ1g0pnygORAnwCYUlYw/gQxdW/8rS0HxD2Gnn/k3DBQOvqQIH4Z3Z3KWVMbGUYhcH1v4SqTAdwg==\n+\n\"@octokit/auth-token@^2.4.0\":\nversion \"2.4.2\"\nresolved \"https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.4.2.tgz#10d0ae979b100fa6b72fa0e8e63e27e6d0dbff8a\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [sqlite] prepare android
Summary: add necessary code to make sqlite work on android
Test Plan: Please read [this](https://phabricator.ashoat.com/D1010)
Reviewers: palys-swm, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1008 |
129,190 | 15.04.2021 12:50:04 | -7,200 | a6fdeb839e14dfbd6cfeb4e11a6ebacc8db57f89 | [sqlite] prepare ios
Summary: introduce necessary changes to make sqlite work on ios
Test Plan: Please read [this](https://phabricator.ashoat.com/D1010)
Reviewers: palys-swm, ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal.xcodeproj/project.pbxproj",
"new_path": "native/ios/SquadCal.xcodeproj/project.pbxproj",
"diff": "13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };\n13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };\n54B457A7302F03F835EC5D92 /* libPods-SquadCal.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A75435FBAC0720E8BE857F55 /* libPods-SquadCal.a */; };\n- 7106C28B25E7D879005556F0 /* NativeModules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7106C28A25E7D879005556F0 /* NativeModules.cpp */; };\n- 7106C28F25E7D8BD005556F0 /* DraftNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7106C28E25E7D8BD005556F0 /* DraftNativeModule.cpp */; };\n711B408425DA97F9005F8F06 /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F26E81B24440D87004049C6 /* dummy.swift */; };\n- 7185F69725F8EA01008581D4 /* SQLiteManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7185F69625F8EA01008581D4 /* SQLiteManager.cpp */; };\n+ 7173BEB22627035D0089BF7A /* NativeModules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7173BE9F2627035D0089BF7A /* NativeModules.cpp */; };\n+ 7173BEB32627035D0089BF7A /* DraftNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7173BEA02627035D0089BF7A /* DraftNativeModule.cpp */; };\n+ 7173BEB62627035D0089BF7A /* SQLiteManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7173BEAA2627035D0089BF7A /* SQLiteManager.cpp */; };\n+ 71CA4AEC262F236100835C89 /* Tools.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71CA4AEB262F236100835C89 /* Tools.mm */; };\n7F761E602201141E001B6FB7 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F761E292201141E001B6FB7 /* JavaScriptCore.framework */; };\n7F788C2C248AA2140098F071 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7F788C2B248AA2130098F071 /* SplashScreen.storyboard */; };\n7FB58ABE1E7F6BD500B4C1B1 /* Anaheim-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7FB58ABB1E7F6BC600B4C1B1 /* Anaheim-Regular.ttf */; };\n13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = SquadCal/main.m; sourceTree = \"<group>\"; };\n47CCD255658AFBDBBBA0DFBA /* Pods-SquadCal.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-SquadCal.debug.xcconfig\"; path = \"Target Support Files/Pods-SquadCal/Pods-SquadCal.debug.xcconfig\"; sourceTree = \"<group>\"; };\n5D92D07F9695E31E05F88732 /* Pods-SquadCal.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-SquadCal.release.xcconfig\"; path = \"Target Support Files/Pods-SquadCal/Pods-SquadCal.release.xcconfig\"; sourceTree = \"<group>\"; };\n- 7106C28925E7D879005556F0 /* NativeModules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NativeModules.h; path = ../../CommonCpp/NativeModules/NativeModules.h; sourceTree = \"<group>\"; };\n- 7106C28A25E7D879005556F0 /* NativeModules.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NativeModules.cpp; path = ../../CommonCpp/NativeModules/NativeModules.cpp; sourceTree = \"<group>\"; };\n- 7106C28D25E7D8BD005556F0 /* DraftNativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DraftNativeModule.h; path = ../../CommonCpp/NativeModules/DraftNativeModule.h; sourceTree = \"<group>\"; };\n- 7106C28E25E7D8BD005556F0 /* DraftNativeModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DraftNativeModule.cpp; path = ../../CommonCpp/NativeModules/DraftNativeModule.cpp; sourceTree = \"<group>\"; };\n711CF80E25DC096000A00FBD /* libFolly.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libFolly.a; sourceTree = BUILT_PRODUCTS_DIR; };\n- 7185F69425F8EA01008581D4 /* SQLiteManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SQLiteManager.h; path = ../../CommonCpp/DatabaseManagers/SQLiteManager.h; sourceTree = \"<group>\"; };\n- 7185F69525F8EA01008581D4 /* DatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseManager.h; path = ../../CommonCpp/DatabaseManagers/DatabaseManager.h; sourceTree = \"<group>\"; };\n- 7185F69625F8EA01008581D4 /* SQLiteManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLiteManager.cpp; path = ../../CommonCpp/DatabaseManagers/SQLiteManager.cpp; sourceTree = \"<group>\"; };\n- 7185F69C25F8EE19008581D4 /* DatabaseManagerInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DatabaseManagerInterface.h; path = ../../CommonCpp/DatabaseManagers/DatabaseManagerInterface.h; sourceTree = \"<group>\"; };\n+ 7173BE9F2627035D0089BF7A /* NativeModules.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NativeModules.cpp; sourceTree = \"<group>\"; };\n+ 7173BEA02627035D0089BF7A /* DraftNativeModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DraftNativeModule.cpp; sourceTree = \"<group>\"; };\n+ 7173BEA12627035D0089BF7A /* NativeModules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeModules.h; sourceTree = \"<group>\"; };\n+ 7173BEA22627035D0089BF7A /* DraftNativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DraftNativeModule.h; sourceTree = \"<group>\"; };\n+ 7173BEA92627035D0089BF7A /* DatabaseManagerInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseManagerInterface.h; sourceTree = \"<group>\"; };\n+ 7173BEAA2627035D0089BF7A /* SQLiteManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteManager.cpp; sourceTree = \"<group>\"; };\n+ 7173BEAB2627035D0089BF7A /* SQLiteManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteManager.h; sourceTree = \"<group>\"; };\n+ 7173BEAC2627035D0089BF7A /* DatabaseManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseManager.h; sourceTree = \"<group>\"; };\n+ 7173BEAE2627035D0089BF7A /* Draft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Draft.h; sourceTree = \"<group>\"; };\n+ 7173BEB12627035D0089BF7A /* sqlite_orm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sqlite_orm.h; sourceTree = \"<group>\"; };\n+ 71CA4AEA262F230A00835C89 /* Tools.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Tools.h; path = SquadCal/Tools.h; sourceTree = \"<group>\"; };\n+ 71CA4AEB262F236100835C89 /* Tools.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = Tools.mm; path = SquadCal/Tools.mm; sourceTree = \"<group>\"; };\n7F26E81B24440D87004049C6 /* dummy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dummy.swift; sourceTree = \"<group>\"; };\n7F554F822332D58B007CB9F7 /* Info.debug.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.debug.plist; path = SquadCal/Info.debug.plist; sourceTree = \"<group>\"; };\n7F761E292201141E001B6FB7 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };\n13B07FB71A68108700A75B9A /* main.m */,\n7FCEA2DC2444010B004017B1 /* SquadCal-Bridging-Header.h */,\n7F26E81B24440D87004049C6 /* dummy.swift */,\n+ 71CA4AEA262F230A00835C89 /* Tools.h */,\n+ 71CA4AEB262F236100835C89 /* Tools.mm */,\n);\nname = SquadCal;\nsourceTree = \"<group>\";\nname = Resources;\nsourceTree = \"<group>\";\n};\n- 7106C28525E7C2E2005556F0 /* CommonCpp */ = {\n+ 7173BE9D2627035D0089BF7A /* CommonCpp */ = {\nisa = PBXGroup;\nchildren = (\n- 7185F69C25F8EE19008581D4 /* DatabaseManagerInterface.h */,\n- 7185F69525F8EA01008581D4 /* DatabaseManager.h */,\n- 7185F69625F8EA01008581D4 /* SQLiteManager.cpp */,\n- 7185F69425F8EA01008581D4 /* SQLiteManager.h */,\n- 7106C28E25E7D8BD005556F0 /* DraftNativeModule.cpp */,\n- 7106C28D25E7D8BD005556F0 /* DraftNativeModule.h */,\n- 7106C28A25E7D879005556F0 /* NativeModules.cpp */,\n- 7106C28925E7D879005556F0 /* NativeModules.h */,\n- );\n- path = CommonCpp;\n+ 7173BE9E2627035D0089BF7A /* NativeModules */,\n+ 7173BEA82627035D0089BF7A /* DatabaseManagers */,\n+ 7173BEAF2627035D0089BF7A /* sqlite_orm */,\n+ );\n+ name = CommonCpp;\n+ path = ../CommonCpp;\n+ sourceTree = \"<group>\";\n+ };\n+ 7173BE9E2627035D0089BF7A /* NativeModules */ = {\n+ isa = PBXGroup;\n+ children = (\n+ 7173BE9F2627035D0089BF7A /* NativeModules.cpp */,\n+ 7173BEA02627035D0089BF7A /* DraftNativeModule.cpp */,\n+ 7173BEA12627035D0089BF7A /* NativeModules.h */,\n+ 7173BEA22627035D0089BF7A /* DraftNativeModule.h */,\n+ );\n+ path = NativeModules;\n+ sourceTree = \"<group>\";\n+ };\n+ 7173BEA82627035D0089BF7A /* DatabaseManagers */ = {\n+ isa = PBXGroup;\n+ children = (\n+ 7173BEA92627035D0089BF7A /* DatabaseManagerInterface.h */,\n+ 7173BEAA2627035D0089BF7A /* SQLiteManager.cpp */,\n+ 7173BEAB2627035D0089BF7A /* SQLiteManager.h */,\n+ 7173BEAC2627035D0089BF7A /* DatabaseManager.h */,\n+ 7173BEAD2627035D0089BF7A /* entities */,\n+ );\n+ path = DatabaseManagers;\n+ sourceTree = \"<group>\";\n+ };\n+ 7173BEAD2627035D0089BF7A /* entities */ = {\n+ isa = PBXGroup;\n+ children = (\n+ 7173BEAE2627035D0089BF7A /* Draft.h */,\n+ );\n+ path = entities;\n+ sourceTree = \"<group>\";\n+ };\n+ 7173BEAF2627035D0089BF7A /* sqlite_orm */ = {\n+ isa = PBXGroup;\n+ children = (\n+ 7173BEB12627035D0089BF7A /* sqlite_orm.h */,\n+ );\n+ path = sqlite_orm;\nsourceTree = \"<group>\";\n};\n7FF0870B1E833C3F000A1ACF /* Frameworks */ = {\n83CBB9F61A601CBA00E9B192 = {\nisa = PBXGroup;\nchildren = (\n- 7106C28525E7C2E2005556F0 /* CommonCpp */,\n+ 7173BE9D2627035D0089BF7A /* CommonCpp */,\n13B07FAE1A68108700A75B9A /* SquadCal */,\n83CBBA001A601CBA00E9B192 /* Products */,\n6534411766BE4CA4B0AB0A78 /* Resources */,\nisa = PBXSourcesBuildPhase;\nbuildActionMask = 2147483647;\nfiles = (\n- 7106C28F25E7D8BD005556F0 /* DraftNativeModule.cpp in Sources */,\n+ 71CA4AEC262F236100835C89 /* Tools.mm in Sources */,\n+ 7173BEB32627035D0089BF7A /* DraftNativeModule.cpp in Sources */,\n13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,\n- 7106C28B25E7D879005556F0 /* NativeModules.cpp in Sources */,\n- 7185F69725F8EA01008581D4 /* SQLiteManager.cpp in Sources */,\n711B408425DA97F9005F8F06 /* dummy.swift in Sources */,\n+ 7173BEB22627035D0089BF7A /* NativeModules.cpp in Sources */,\n13B07FC11A68108700A75B9A /* main.m in Sources */,\n+ 7173BEB62627035D0089BF7A /* SQLiteManager.cpp in Sources */,\n);\nrunOnlyForDeploymentPostprocessing = 0;\n};\nASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\nCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\nCLANG_ENABLE_MODULES = YES;\n+ CLANG_WARN_OBJC_ROOT_CLASS = YES;\nCODE_SIGN_ENTITLEMENTS = SquadCal/SquadCal.entitlements;\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCURRENT_PROJECT_VERSION = 1;\nASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\nCLANG_CXX_LANGUAGE_STANDARD = \"gnu++14\";\nCLANG_ENABLE_MODULES = YES;\n+ CLANG_WARN_OBJC_ROOT_CLASS = YES;\nCODE_SIGN_ENTITLEMENTS = SquadCal/SquadCal.entitlements;\n\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\nCURRENT_PROJECT_VERSION = 1;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/AppDelegate.mm",
"new_path": "native/ios/SquadCal/AppDelegate.mm",
"diff": "#import <React/RCTCxxBridgeDelegate.h>\n#import <cxxreact/JSExecutor.h>\n+#import <string>\n+\n+#import \"Tools.h\"\n#import \"DraftNativeModule.h\"\n+#import \"SQLiteManager.h\"\n#ifdef FB_SONARKIT_ENABLED\n#import <FlipperKit/FlipperClient.h>\n@@ -133,7 +137,7 @@ using Runtime = facebook::jsi::Runtime;\n- (std::unique_ptr<ExecutorFactory>)jsExecutorFactoryForBridge\n:(RCTBridge *)bridge {\n__weak __typeof(self) weakSelf = self;\n- return std::make_unique<ExecutorFactory>([=](Runtime &runtime) {\n+ return std::make_unique<ExecutorFactory>([=](Runtime &rt) {\nif (!bridge) {\nreturn;\n}\n@@ -142,12 +146,15 @@ using Runtime = facebook::jsi::Runtime;\nstd::shared_ptr<comm::DraftNativeModule> nativeModule =\nstd::make_shared<comm::DraftNativeModule>(bridge.jsCallInvoker);\n-\n- runtime.global().setProperty(\n- runtime,\n- jsi::PropNameID::forAscii(runtime, \"draftModule\"),\n- jsi::Object::createFromHostObject(runtime, nativeModule)\n+ rt.global().setProperty(\n+ rt,\n+ facebook::jsi::PropNameID::forAscii(rt, \"draftModule\"),\n+ facebook::jsi::Object::createFromHostObject(rt, nativeModule)\n);\n+\n+ // set sqlite file path\n+ comm::SQLiteManager::sqliteFilePath =\n+ std::string([[Tools getSQLiteFilePath] UTF8String]);\n}\n});\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/ios/SquadCal/Tools.h",
"diff": "+#pragma once\n+\n+#import <UIKit/UIKit.h>\n+\n+@interface Tools : NSObject\n++ (NSString*)getSQLiteFilePath;\n+@end\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/ios/SquadCal/Tools.mm",
"diff": "+#import \"Tools.h\"\n+#import <stdexcept>\n+#import <Foundation/Foundation.h>\n+\n+@implementation Tools\n+\n++ (NSString*)getSQLiteFilePath {\n+ NSError *err = nil;\n+ NSURL *documentsUrl = [NSFileManager.defaultManager\n+ URLForDirectory:NSDocumentDirectory\n+ inDomain:NSUserDomainMask\n+ appropriateForURL:nil\n+ create:false\n+ error:&err];\n+\n+ if (err) {\n+ NSLog(@\"Error: %@\", err);\n+ throw std::runtime_error(\"Failed to resolve database path - could not find documentsUrl\");\n+ }\n+\n+ return [documentsUrl URLByAppendingPathComponent:@\"comm.sqlite\"].path;\n+}\n+\n+@end\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [sqlite] prepare ios
Summary: introduce necessary changes to make sqlite work on ios
Test Plan: Please read [this](https://phabricator.ashoat.com/D1010)
Reviewers: palys-swm, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1009 |
129,191 | 22.04.2021 17:50:18 | -7,200 | 815625b26bf59d756693d743860480d15937d7fb | [native] Do not prune pending threads
Test Plan: Increase pruning frequency, create pending thread with failed message, open another thread and verify that pending thread is not included in pruning action.
Reviewers: ashoat
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/selectors/message-selectors.js",
"new_path": "native/selectors/message-selectors.js",
"diff": "import { createSelector } from 'reselect';\n+import { threadIsPending } from 'lib/shared/thread-utils';\nimport type { ThreadMessageInfo } from 'lib/types/message-types';\nimport { activeThreadSelector } from '../navigation/nav-selectors';\n@@ -42,7 +43,7 @@ const pruneThreadIDsSelector: (\nconst now = Date.now();\nconst threadIDsToPrune = [];\nfor (const threadID in threadMessageInfos) {\n- if (threadID === activeThread) {\n+ if (threadID === activeThread || threadIsPending(threadID)) {\ncontinue;\n}\nconst threadMessageInfo = threadMessageInfos[threadID];\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Do not prune pending threads
Test Plan: Increase pruning frequency, create pending thread with failed message, open another thread and verify that pending thread is not included in pruning action.
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1040 |
129,184 | 22.04.2021 16:57:09 | 14,400 | a4ab86cee3847cab51f7c00c3408d24e5af5e4b1 | [landing] Animate eye animation on scroll with `lottie-interactivity`
Summary: Introduce `lottie-interactivity` and use it to animation eye illustration on scroll.
Test Plan: Looks fine on Chrome/Safari/Firefox
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "// @flow\n+import { create } from '@lottiefiles/lottie-interactivity';\nimport * as React from 'react';\nimport Particles from 'react-particles-js';\nimport css from './landing.css';\nimport particlesConfig from './particles-config.json';\n+const useIsomorphicLayoutEffect =\n+ typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n+\nfunction Landing(): React.Node {\nReact.useEffect(() => {\nimport('@lottiefiles/lottie-player');\n}, []);\n+ const onEyeIllustrationLoad = React.useCallback(() => {\n+ create({\n+ mode: 'scroll',\n+ player: '#eye-illustration',\n+ actions: [\n+ {\n+ visibility: [0, 1],\n+ type: 'seek',\n+ frames: [0, 720],\n+ },\n+ ],\n+ });\n+ }, []);\n+\n+ const [eyeNode, setEyeNode] = React.useState(null);\n+ useIsomorphicLayoutEffect(() => {\n+ if (!eyeNode) {\n+ return;\n+ }\n+ eyeNode.addEventListener('load', onEyeIllustrationLoad);\n+ return () => eyeNode.removeEventListener('load', onEyeIllustrationLoad);\n+ }, [eyeNode, onEyeIllustrationLoad]);\n+\nreturn (\n<div>\n<Particles canvasClassName={css.particles} params={particlesConfig} />\n@@ -18,9 +45,8 @@ function Landing(): React.Node {\n<div className={css.grid}>\n<div className={css.hero_image}>\n<lottie-player\n- autoplay\n- loop\nid=\"eye-illustration\"\n+ ref={setEyeNode}\nmode=\"normal\"\nsrc=\"../comm/images/animated_eye.json\"\nspeed={0.5}\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/package.json",
"new_path": "landing/package.json",
"diff": "},\n\"dependencies\": {\n\"@babel/runtime\": \"^7.13.10\",\n+ \"@lottiefiles/lottie-interactivity\": \"^0.1.4\",\n\"@lottiefiles/lottie-player\": \"^1.0.3\",\n\"core-js\": \"^3.6.5\",\n\"invariant\": \"^2.2.4\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "\"@types/yargs\" \"^15.0.0\"\nchalk \"^4.0.0\"\n+\"@lottiefiles/lottie-interactivity@^0.1.4\":\n+ version \"0.1.4\"\n+ resolved \"https://registry.yarnpkg.com/@lottiefiles/lottie-interactivity/-/lottie-interactivity-0.1.4.tgz#6a39eb6bf4050dd22c90901ca204e5c01fd5de86\"\n+ integrity sha512-lr8NqxJxVk4PW9mrbCRXNHHCnm+ms15hb1flG8NrtAMykVcR3DvSDylT3SHAW7VehuwK3Cv8SnuOFP0/ugxQ5Q==\n+ dependencies:\n+ core-js \"3\"\n+\n\"@lottiefiles/lottie-player@^1.0.3\":\nversion \"1.0.3\"\nresolved \"https://registry.yarnpkg.com/@lottiefiles/lottie-player/-/lottie-player-1.0.3.tgz#4d387d2cd1f9787dad8a74f1879e266dde66bc57\"\n@@ -6172,6 +6179,11 @@ core-js-pure@^3.0.0:\nresolved \"https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813\"\nintegrity sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA==\n+core-js@3:\n+ version \"3.10.2\"\n+ resolved \"https://registry.yarnpkg.com/core-js/-/core-js-3.10.2.tgz#17cb038ce084522a717d873b63f2b3ee532e2cd5\"\n+ integrity sha512-W+2oVYeNghuBr3yTzZFQ5rfmjZtYB/Ubg87R5YOmlGrIb+Uw9f7qjUbhsj+/EkXhcV7eOD3jiM4+sgraX3FZUw==\n+\ncore-js@^1.0.0:\nversion \"1.2.7\"\nresolved \"https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Animate eye animation on scroll with `lottie-interactivity`
Summary: Introduce `lottie-interactivity` and use it to animation eye illustration on scroll.
Test Plan: Looks fine on Chrome/Safari/Firefox
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1041 |
129,184 | 23.04.2021 14:56:58 | 14,400 | b84ae6c5a56f404994f89306cba9b34c5584b204 | [landing] Read the docs button
Summary:
Button that links to Comm docs in Notion. SVG exported from Figma mockup.
What it looks like:
On hover:
Test Plan: Looks fine in Safari/Chrome/Firefox
Reviewers: ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "@@ -6,6 +6,7 @@ import Particles from 'react-particles-js';\nimport css from './landing.css';\nimport particlesConfig from './particles-config.json';\n+import ReadDocsButton from './read-docs-btn.react';\nconst useIsomorphicLayoutEffect =\ntypeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n@@ -93,7 +94,7 @@ function Landing(): React.Node {\n</div>\n<div className={css.read_the_docs}>\n- <p>There's gonna be a button here someday.</p>\n+ <ReadDocsButton />\n</div>\n</div>\n</div>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/read-docs-btn.css",
"diff": "+.button {\n+ position: relative;\n+ height: 160px;\n+ width: 600px;\n+ border: 2px solid white;\n+ color: white;\n+ background: transparent;\n+ padding: 28px;\n+ cursor: pointer;\n+ text-align: left;\n+ padding-top: 100px;\n+ border-radius: 8px;\n+ font-family: 'IBM Plex Sans', sans-serif;\n+ font-size: 24px;\n+}\n+\n+.button:hover {\n+ background-color: white;\n+ color: black;\n+}\n+\n+.button:hover img {\n+ filter: invert(1);\n+}\n+\n+.cornerIcon {\n+ position: absolute;\n+ top: 20px;\n+ right: 20px;\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/read-docs-btn.react.js",
"diff": "+// @flow\n+\n+import * as React from 'react';\n+\n+import css from './read-docs-btn.css';\n+\n+function ReadDocsButton(): React.Node {\n+ return (\n+ <a href=\"https://www.notion.so/Comm-4ec7bbc1398442ce9add1d7953a6c584\">\n+ <button className={css.button}>\n+ Read the documentation\n+ <span className={css.cornerIcon}>\n+ <img src=\"../comm/images/corner_arrow.svg\"></img>\n+ </span>\n+ </button>\n+ </a>\n+ );\n+}\n+export default ReadDocsButton;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/images/corner_arrow.svg",
"diff": "+<svg width=\"31\" height=\"30\" viewBox=\"0 0 31 30\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n+<path d=\"M1.5 29L29.5 1M29.5 1H1.5M29.5 1V29\" stroke=\"white\" stroke-width=\"2\"/>\n+</svg>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Read the docs button
Summary:
Button that links to Comm docs in Notion. SVG exported from Figma mockup.
What it looks like: https://blob.sh/atul/2516.png
On hover: https://blob.sh/atul/7528.png
Test Plan: Looks fine in Safari/Chrome/Firefox
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1045 |
129,184 | 23.04.2021 15:45:35 | 14,400 | 072b16b561ad51bd99ad842af7602e186272552c | [landing] "Subscribe for updates" button
Summary:
Here's what it looks like:
On hover:
Test Plan: Looks fine on Safari/Chrome/Firefox
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/subscribe-btn.css",
"diff": "+.button {\n+ width: 265px;\n+ height: 68px;\n+ position: relative;\n+ border: none;\n+ background: transparent;\n+ padding: 24px, 32px, 24px, 32px;\n+ cursor: pointer;\n+ border-radius: 8px;\n+ font-family: 'IBM Plex Sans', sans-serif;\n+ font-size: 20px;\n+ color: white;\n+ background: #7e57c2;\n+ box-shadow: -12px 20px 50px rgba(126, 87, 194, 0.5);\n+}\n+\n+.button:hover {\n+ border: none;\n+ background-color: #8c69c9;\n+ box-shadow: -12px 20px 50px rgba(139, 107, 194, 0.5);\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/subscribe-btn.react.js",
"diff": "+// @flow\n+\n+import * as React from 'react';\n+\n+import css from './subscribe-btn.css';\n+\n+function SubscribeButton(): React.Node {\n+ return (\n+ <a href=\"https://www.squadcal.org\">\n+ <button className={css.button}>Subscribe for updates</button>\n+ </a>\n+ );\n+}\n+export default SubscribeButton;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] "Subscribe for updates" button
Summary:
Here's what it looks like:
https://blob.sh/atul/0fd5.png
On hover:
https://blob.sh/atul/812e.png
Test Plan: Looks fine on Safari/Chrome/Firefox
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1046 |
129,190 | 23.04.2021 10:02:25 | -7,200 | 9fd65c50924c2a83bebc6d8990134a9d2b1250e8 | [sqlite] simplify sqlite_orm path
Summary: Add `sqlite_orm` path so the `#include` looks better in `SQLiteManager.h`
Test Plan: build the app for iOS/android
Reviewers: palys-swm, ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/CommonCpp/DatabaseManagers/SQLiteManager.h",
"new_path": "native/CommonCpp/DatabaseManagers/SQLiteManager.h",
"diff": "#pragma once\n-#include \"../sqlite_orm/sqlite_orm.h\"\n+#include \"sqlite_orm.h\"\n#include \"DatabaseManagerInterface.h\"\n#include \"entities/Draft.h\"\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/CMakeLists.txt",
"new_path": "native/android/app/CMakeLists.txt",
"diff": "@@ -24,6 +24,7 @@ include_directories(\n../../node_modules/react-native/ReactCommon/turbomodule/core\n# sqlite code\n../../node_modules/@nozbe/sqlite/sqlite-amalgamation-3310100\n+ ../../CommonCpp/sqlite_orm\n# comm android specific code\n./src/cpp\n# comm native mutual code\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [sqlite] simplify sqlite_orm path
Summary: Add `sqlite_orm` path so the `#include` looks better in `SQLiteManager.h`
Test Plan: build the app for iOS/android
Reviewers: palys-swm, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1042 |
129,184 | 26.04.2021 15:13:44 | 14,400 | 8c7b3a3d0f6095944cf2fb17f1b88de871ffb054 | [landing] fix paths so they'll work on prod
Summary: Modify `server.js` so `images`/`fonts`/`icons` can be accessed from `commlanding` root
Test Plan: Assets appear correctly on Safari/Chrome/Firefox
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "@@ -49,7 +49,7 @@ function Landing(): React.Node {\nid=\"eye-illustration\"\nref={setEyeNode}\nmode=\"normal\"\n- src=\"../comm/images/animated_eye.json\"\n+ src=\"images/animated_eye.json\"\nspeed={0.5}\n></lottie-player>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/read-docs-btn.react.js",
"new_path": "landing/read-docs-btn.react.js",
"diff": "@@ -10,7 +10,7 @@ function ReadDocsButton(): React.Node {\n<button className={css.button}>\nRead the documentation\n<span className={css.cornerIcon}>\n- <img src=\"../comm/images/corner_arrow.svg\"></img>\n+ <img src=\"images/corner_arrow.svg\"></img>\n</span>\n</button>\n</a>\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -41,8 +41,10 @@ if (cluster.isMaster) {\nconst router = express.Router();\nrouter.use('/images', express.static('images'));\n+ router.use('/commlanding/images', express.static('images'));\nif (process.env.NODE_ENV === 'dev') {\nrouter.use('/fonts', express.static('fonts'));\n+ router.use('/commlanding/fonts', express.static('fonts'));\n}\nrouter.use('/misc', express.static('misc'));\nrouter.use(\n@@ -68,6 +70,7 @@ if (cluster.isMaster) {\nexpress.static('landing_compiled', compiledFolderOptions),\n);\nrouter.use('/', express.static('icons'));\n+ router.use('/commlanding', express.static('landing-icons'));\nfor (const endpoint in jsonEndpoints) {\n// $FlowFixMe Flow thinks endpoint is string\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] fix paths so they'll work on prod
Summary: Modify `server.js` so `images`/`fonts`/`icons` can be accessed from `commlanding` root
Test Plan: Assets appear correctly on Safari/Chrome/Firefox
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1056 |
129,184 | 26.04.2021 11:53:01 | 14,400 | d61d48439e005799355d0b6a59652b9f74f5572f | [landing] Email subscription form
Summary: Here's what it looks like:
Test Plan: Looks good on Safari/Chrome/Firefox
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/subscription-form.css",
"diff": "+form {\n+ display: flex;\n+}\n+\n+.button {\n+ position: relative;\n+ width: auto;\n+ height: 50px;\n+ border: 1px solid white;\n+ border-radius: 8px;\n+ border-left: none;\n+ border-top-left-radius: 0px;\n+ border-bottom-left-radius: 0px;\n+\n+ padding-left: 20px;\n+ padding-right: 20px;\n+ cursor: pointer;\n+ font-family: 'IBM Plex Sans', sans-serif;\n+ font-size: 18px;\n+ color: white;\n+\n+ background: #7e57c2;\n+ box-shadow: -12px 20px 50px rgba(126, 87, 194, 0.5);\n+}\n+\n+.button:hover {\n+ background-color: #8c69c9;\n+ box-shadow: -12px 20px 50px rgba(139, 107, 194, 0.5);\n+}\n+\n+input.email_input {\n+ flex: 1;\n+ height: 46px;\n+ border-radius: 8px;\n+ padding-left: 20px;\n+ padding-right: 20px;\n+ background: transparent;\n+\n+ font-family: 'IBM Plex Mono', monospace;\n+ font-size: 18px;\n+ color: white;\n+\n+ border: 1px solid white;\n+ border-right: none;\n+ border-top-right-radius: 0px;\n+ border-bottom-right-radius: 0px;\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "landing/subscription-form.react.js",
"diff": "+// @flow\n+\n+import * as React from 'react';\n+\n+import css from './subscription-form.css';\n+\n+function SubscriptionForm(): React.Node {\n+ return (\n+ <form>\n+ <input className={css.email_input} placeholder=\"Enter your email\" />\n+ <button className={css.button}>Subscribe for updates</button>\n+ </form>\n+ );\n+}\n+export default SubscriptionForm;\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Email subscription form
Summary: Here's what it looks like: https://blob.sh/atul/d0a1.png
Test Plan: Looks good on Safari/Chrome/Firefox
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1052 |
129,184 | 26.04.2021 12:01:44 | 14,400 | fde4c9182913087ad3047dc9b3d31d3d20c2ceaf | [landing] Styling and layout changes
Summary: Miscellaneous styling and layout changes.
Test Plan: Looks good on Safari/Chrome/Firefox.
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.css",
"new_path": "landing/landing.css",
"diff": "html {\n- background: radial-gradient(ellipse at bottom, #374151, #111827);\n+ background: radial-gradient(ellipse at bottom, #1f252e, #111827);\nbackground-attachment: fixed;\nfont-family: 'IBM Plex Sans', sans-serif;\ncolor: white;\n@@ -8,12 +8,13 @@ html {\nh1,\nh2 {\nfont-family: 'IBM Plex Mono', monospace;\n+ font-weight: 600;\n}\nh1.title {\nfont-family: 'IBM Plex Sans', sans-serif;\nfont-size: 24px;\n- padding-left: 80px;\n+ padding-left: 60px;\n}\nspan.purple {\n@@ -21,11 +22,11 @@ span.purple {\n}\nh2.lede {\n- font-size: 80px;\n+ font-size: 56px;\n}\nh2 {\n- font-size: 60px;\n+ font-size: 50px;\n}\np {\n@@ -34,60 +35,85 @@ p {\ndiv.grid {\ndisplay: grid;\n- padding: 80px;\n- row-gap: 18em;\n+ padding-top: 20px;\n+ padding-left: 60px;\n+ padding-right: 60px;\n+ row-gap: 14em;\ncolumn-gap: 4em;\n+ grid-template-rows: 1fr 1fr 1fr 1/6fr;\ngrid-template-columns: 1fr 1fr;\ngrid-template-areas:\n'hero_copy hero_image'\n'server_copy server_image'\n- 'keyserver_copy read_the_docs';\n+ 'keyserver_copy read_the_docs'\n+ 'footer_logo subscribe_updates';\n}\n@media (max-width: 1099px) {\ndiv.grid {\ndisplay: grid;\n- padding: 80px;\n- row-gap: 18em;\n+ padding-left: 60px;\n+ padding-right: 60px;\n+ row-gap: 2em;\n+ grid-template-columns: 1fr;\ngrid-template-areas:\n'hero_image'\n'hero_copy'\n'server_image'\n'server_copy'\n'keyserver_copy'\n- 'read_the_docs';\n+ 'read_the_docs'\n+ 'subscribe_updates'\n+ 'footer_logo';\n}\n}\ndiv.hero_copy {\ngrid-area: hero_copy;\n+ align-self: center;\n}\ndiv.hero_image {\ngrid-area: hero_image;\n- width: 600px;\n- height: 600px;\n- margin-left: auto;\n- margin-right: auto;\n+ object-fit: scale-down;\n+ align-self: center;\n}\ndiv.server_copy {\ngrid-area: server_copy;\n+ align-self: center;\n}\ndiv.server_image {\ngrid-area: server_image;\n- background-image: url(../images/server_illustration.svg);\n- width: 617px;\nheight: 535px;\n+ width: 100%;\n+ background-image: url(../images/server_illustration.svg);\n+ background-repeat: no-repeat;\n+ background-position: center;\n+ object-fit: scale-down;\n}\ndiv.keyserver_copy {\ngrid-area: keyserver_copy;\n+ align-self: center;\n}\ndiv.read_the_docs {\ngrid-area: read_the_docs;\n+ align-self: flex-end;\n+}\n+\n+div.footer_logo {\n+ font-family: 'IBM Plex Sans', sans-serif;\n+ font-size: 24px;\n+ grid-area: footer_logo;\n+ align-self: center;\n+ font-weight: 600;\n+}\n+\n+div.subscribe_updates {\n+ grid-area: subscribe_updates;\n}\ncanvas.particles {\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "@@ -7,6 +7,7 @@ import Particles from 'react-particles-js';\nimport css from './landing.css';\nimport particlesConfig from './particles-config.json';\nimport ReadDocsButton from './read-docs-btn.react';\n+import SubscriptionForm from './subscription-form.react';\nconst useIsomorphicLayoutEffect =\ntypeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;\n@@ -92,10 +93,14 @@ function Landing(): React.Node {\nbrain.\n</p>\n</div>\n-\n<div className={css.read_the_docs}>\n<ReadDocsButton />\n</div>\n+\n+ <div className={css.footer_logo}>Comm</div>\n+ <div className={css.subscribe_updates}>\n+ <SubscriptionForm />\n+ </div>\n</div>\n</div>\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/read-docs-btn.css",
"new_path": "landing/read-docs-btn.css",
"diff": ".button {\nposition: relative;\nheight: 160px;\n- width: 600px;\n+ width: 100%;\nborder: 2px solid white;\ncolor: white;\nbackground: transparent;\n"
},
{
"change_type": "DELETE",
"old_path": "landing/subscribe-btn.css",
"new_path": null,
"diff": "-.button {\n- width: 265px;\n- height: 68px;\n- position: relative;\n- border: none;\n- background: transparent;\n- padding: 24px, 32px, 24px, 32px;\n- cursor: pointer;\n- border-radius: 8px;\n- font-family: 'IBM Plex Sans', sans-serif;\n- font-size: 20px;\n- color: white;\n- background: #7e57c2;\n- box-shadow: -12px 20px 50px rgba(126, 87, 194, 0.5);\n-}\n-\n-.button:hover {\n- border: none;\n- background-color: #8c69c9;\n- box-shadow: -12px 20px 50px rgba(139, 107, 194, 0.5);\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "landing/subscribe-btn.react.js",
"new_path": null,
"diff": "-// @flow\n-\n-import * as React from 'react';\n-\n-import css from './subscribe-btn.css';\n-\n-function SubscribeButton(): React.Node {\n- return (\n- <a href=\"https://www.squadcal.org\">\n- <button className={css.button}>Subscribe for updates</button>\n- </a>\n- );\n-}\n-export default SubscribeButton;\n"
},
{
"change_type": "MODIFY",
"old_path": "server/images/server_illustration.svg",
"new_path": "server/images/server_illustration.svg",
"diff": "-<svg width=\"617\" height=\"535\" viewBox=\"0 0 617 535\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n+<svg viewBox=\"0 0 617 535\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M243 209C237.477 209 233 213.477 233 219V279C233 284.523 237.477 289 243 289C237.477 289 233 293.477 233 299V359C233 364.523 237.477 369 243 369C237.477 369 233 373.477 233 379V439C233 444.523 237.477 449 243 449H373C378.523 449 383 444.523 383 439V379C383 373.477 378.523 369 373 369C378.523 369 383 364.523 383 359V299C383 293.477 378.523 289 373 289C378.523 289 383 284.523 383 279V219C383 213.477 378.523 209 373 209H243ZM288 249C288 244.582 291.582 241 296 241H355C359.418 241 363 244.582 363 249C363 253.418 359.418 257 355 257H296C291.582 257 288 253.418 288 249ZM288 329C288 324.582 291.582 321 296 321H355C359.418 321 363 324.582 363 329C363 333.418 359.418 337 355 337H296C291.582 337 288 333.418 288 329ZM296 401C291.582 401 288 404.582 288 409C288 413.418 291.582 417 296 417H355C359.418 417 363 413.418 363 409C363 404.582 359.418 401 355 401H296Z\" fill=\"#7E57C2\"/>\n<path d=\"M243 289H373M243 289C237.477 289 233 284.523 233 279V219C233 213.477 237.477 209 243 209H373C378.523 209 383 213.477 383 219V279C383 284.523 378.523 289 373 289M243 289C237.477 289 233 293.477 233 299V359C233 364.523 237.477 369 243 369M373 289C378.523 289 383 293.477 383 299V359C383 364.523 378.523 369 373 369M243 369H373M243 369C237.477 369 233 373.477 233 379V439C233 444.523 237.477 449 243 449H373C378.523 449 383 444.523 383 439V379C383 373.477 378.523 369 373 369M326 515C326 524.941 317.941 533 308 533C298.059 533 290 524.941 290 515M326 515C326 505.059 317.941 497 308 497M326 515H370M290 515C290 505.059 298.059 497 308 497M290 515L190 515M308 497V449M123 515L169 515M106.5 515L73 515M547.5 515L514 515M57.5 515L40 515M576 515H559M498.5 515L391 515M177.001 78.5696C177.001 78.5696 186.86 54.9867 218.426 29.9903C226.686 23.4492 235.418 18.461 243.809 14.6608M288.446 2.67456C288.446 2.67456 277.986 3.3054 263.5 7.45491M550.096 24.0001C550.096 24.0001 572.608 39.1824 594.19 73.1751C595.254 74.8512 596.261 76.5311 597.215 78.2104M614 142.728C614 142.728 615.02 122.24 606.074 97.5001M2 173.511C2 173.511 2.42585 167.552 4.34052 159.5M38.1283 112C38.1283 112 25.0975 118.217 14.3389 134.808C13.311 136.393 12.3669 138.029 11.5 139.691M365.375 67.0001C301.599 67.0001 245.923 101.641 216.185 153.11C203.492 146.892 189.217 143.4 174.125 143.4C158.809 143.4 144.334 146.996 131.5 153.389M365.375 67.0001C285.077 67.0001 217.62 121.913 198.604 196.189M365.375 67.0001C401.626 67.0001 435.259 78.1919 463 97.3043M167.348 449L116.75 449C73.5774 449 35.9734 425.189 16.3862 390M468.543 449L517 449M470.18 270.998C484.331 262.735 500.799 258 518.375 258C537.39 258 555.109 263.543 570 273.099C559.895 266.614 548.488 261.978 536.257 259.667C537.078 252.859 537.5 245.929 537.5 238.9C537.5 187.688 515.077 141.707 479.5 110.215M101.949 301.548C87.3432 284.779 78.5 262.871 78.5 238.9C78.5 208.907 92.3447 182.143 114 164.635C95.4984 179.594 82.6981 201.308 79.3623 226.021C34.3438 241.507 2 284.181 2 334.4C2 347.013 4.04031 359.15 7.80931 370.5M386.35 166.946C386.35 166.946 404.259 173.333 417.5 188C418.403 189 419.27 190.002 420.103 191M436.414 217.697C436.414 217.697 435.021 214.007 432.006 208.5M586.517 286.5C603.513 303.739 614 327.396 614 353.5C614 399.548 581.367 437.984 537.937 447M296 257H355C359.418 257 363 253.418 363 249C363 244.582 359.418 241 355 241H296C291.582 241 288 244.582 288 249C288 253.418 291.582 257 296 257ZM296 337H355C359.418 337 363 333.418 363 329C363 324.582 359.418 321 355 321H296C291.582 321 288 324.582 288 329C288 333.418 291.582 337 296 337ZM296 417H355C359.418 417 363 413.418 363 409C363 404.582 359.418 401 355 401H296C291.582 401 288 404.582 288 409C288 413.418 291.582 417 296 417Z\" stroke=\"white\" stroke-width=\"4\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n<path d=\"M14 380.5C14 381.881 12.8807 383 11.5 383C10.1193 383 9 381.881 9 380.5C9 379.119 10.1193 378 11.5 378C12.8807 378 14 379.119 14 380.5Z\" fill=\"white\"/>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Styling and layout changes
Summary: Miscellaneous styling and layout changes.
Test Plan: Looks good on Safari/Chrome/Firefox.
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1053 |
129,184 | 26.04.2021 14:23:17 | 14,400 | 982c341515cefdea69d4295d50cf7523d1aeb138 | [landing] favicon
Summary: Added favicons from Daniel
Test Plan: Looks find on Safari/Chrome/Firefox
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "ADD",
"old_path": "server/landing_icons/apple-touch-icon.png",
"new_path": "server/landing_icons/apple-touch-icon.png",
"diff": "Binary files /dev/null and b/server/landing_icons/apple-touch-icon.png differ\n"
},
{
"change_type": "ADD",
"old_path": "server/landing_icons/landing-favicon-16x16.png",
"new_path": "server/landing_icons/landing-favicon-16x16.png",
"diff": "Binary files /dev/null and b/server/landing_icons/landing-favicon-16x16.png differ\n"
},
{
"change_type": "ADD",
"old_path": "server/landing_icons/landing-favicon-32x32.png",
"new_path": "server/landing_icons/landing-favicon-32x32.png",
"diff": "Binary files /dev/null and b/server/landing_icons/landing-favicon-32x32.png differ\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/landing-handler.js",
"new_path": "server/src/responders/landing-handler.js",
"diff": "@@ -103,6 +103,23 @@ async function landingResponder(req: $Request, res: $Response) {\n<base href=\"${basePath}\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"${fontsURL}\" />\n${cssInclude}\n+ <link\n+ rel=\"apple-touch-icon\"\n+ sizes=\"180x180\"\n+ href=\"apple-touch-icon.png\"\n+ />\n+ <link\n+ rel=\"icon\"\n+ type=\"image/png\"\n+ sizes=\"32x32\"\n+ href=\"landing-favicon-32x32.png\"\n+ />\n+ <link\n+ rel=\"icon\"\n+ type=\"image/png\"\n+ sizes=\"16x16\"\n+ href=\"landing-favicon-16x16.png\"\n+ />\n</head>\n<body>\n<div id=\"react-root\">\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -70,7 +70,7 @@ if (cluster.isMaster) {\nexpress.static('landing_compiled', compiledFolderOptions),\n);\nrouter.use('/', express.static('icons'));\n- router.use('/commlanding', express.static('landing-icons'));\n+ router.use('/commlanding', express.static('landing_icons'));\nfor (const endpoint in jsonEndpoints) {\n// $FlowFixMe Flow thinks endpoint is string\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] favicon
Summary: Added favicons from Daniel
Test Plan: Looks find on Safari/Chrome/Firefox
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1055 |
129,190 | 23.04.2021 13:28:47 | -7,200 | 53b671166e40590bd172f894c8595124e2787c6e | [jsi] rename native module
Summary: rename native module exposed to js from `draftModule` to `CommCoreModule`
Test Plan: use `global.CommCoreModule.getDraft` and `global.CommCoreModule.updateDraft`
Reviewers: palys-swm, ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian, atul | [
{
"change_type": "RENAME",
"old_path": "native/CommonCpp/NativeModules/DraftNativeModule.cpp",
"new_path": "native/CommonCpp/NativeModules/CommCoreModule.cpp",
"diff": "-#include \"DraftNativeModule.h\"\n+#include \"CommCoreModule.h\"\n#include \"DatabaseManager.h\"\nnamespace comm {\n-jsi::String DraftNativeModule::getDraft(\n+jsi::String CommCoreModule::getDraft(\njsi::Runtime &rt,\nconst jsi::String &threadID\n) {\n@@ -12,7 +12,7 @@ jsi::String DraftNativeModule::getDraft(\nreturn jsi::String::createFromUtf8(rt, draft);\n}\n-bool DraftNativeModule::updateDraft(\n+bool CommCoreModule::updateDraft(\njsi::Runtime &rt,\nconst jsi::Object &draft\n) {\n"
},
{
"change_type": "RENAME",
"old_path": "native/CommonCpp/NativeModules/DraftNativeModule.h",
"new_path": "native/CommonCpp/NativeModules/CommCoreModule.h",
"diff": "@@ -7,12 +7,12 @@ namespace comm {\nnamespace jsi = facebook::jsi;\n-class DraftNativeModule : public facebook::react::DraftSchemaCxxSpecJSI {\n+class CommCoreModule : public facebook::react::CommCoreModuleSchemaCxxSpecJSI {\njsi::String getDraft(jsi::Runtime &rt, const jsi::String &threadID) override;\nbool updateDraft(jsi::Runtime &rt, const jsi::Object &draft) override;\npublic:\n- DraftNativeModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker) :\n- facebook::react::DraftSchemaCxxSpecJSI(jsInvoker) {};\n+ CommCoreModule(std::shared_ptr<facebook::react::CallInvoker> jsInvoker) :\n+ facebook::react::CommCoreModuleSchemaCxxSpecJSI(jsInvoker) {};\n};\n} // namespace comm\n"
},
{
"change_type": "MODIFY",
"old_path": "native/CommonCpp/NativeModules/NativeModules.cpp",
"new_path": "native/CommonCpp/NativeModules/NativeModules.cpp",
"diff": "namespace facebook {\nnamespace react {\n-static jsi::Value __hostFunction_DraftSchemaCxxSpecJSI_getDraft(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {\n- return static_cast<DraftSchemaCxxSpecJSI *>(&turboModule)->getDraft(rt, args[0].getString(rt));\n+static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getDraft(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {\n+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->getDraft(rt, args[0].getString(rt));\n}\n-static jsi::Value __hostFunction_DraftSchemaCxxSpecJSI_updateDraft(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {\n- return static_cast<DraftSchemaCxxSpecJSI *>(&turboModule)->updateDraft(rt, args[0].getObject(rt));\n+static jsi::Value __hostFunction_CommCoreModuleSchemaCxxSpecJSI_updateDraft(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {\n+ return static_cast<CommCoreModuleSchemaCxxSpecJSI *>(&turboModule)->updateDraft(rt, args[0].getObject(rt));\n}\n-DraftSchemaCxxSpecJSI::DraftSchemaCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)\n+CommCoreModuleSchemaCxxSpecJSI::CommCoreModuleSchemaCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)\n: TurboModule(\"CommTurboModule\", jsInvoker) {\n- methodMap_[\"getDraft\"] = MethodMetadata {1, __hostFunction_DraftSchemaCxxSpecJSI_getDraft};\n- methodMap_[\"updateDraft\"] = MethodMetadata {1, __hostFunction_DraftSchemaCxxSpecJSI_updateDraft};\n+ methodMap_[\"getDraft\"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_getDraft};\n+ methodMap_[\"updateDraft\"] = MethodMetadata {1, __hostFunction_CommCoreModuleSchemaCxxSpecJSI_updateDraft};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/CommonCpp/NativeModules/NativeModules.h",
"new_path": "native/CommonCpp/NativeModules/NativeModules.h",
"diff": "namespace facebook {\nnamespace react {\n-class JSI_EXPORT DraftSchemaCxxSpecJSI : public TurboModule {\n+class JSI_EXPORT CommCoreModuleSchemaCxxSpecJSI : public TurboModule {\nprotected:\n- DraftSchemaCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);\n+ CommCoreModuleSchemaCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);\npublic:\nvirtual jsi::String getDraft(jsi::Runtime &rt, const jsi::String &threadID) = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/cpp/jsiInstaller.cpp",
"new_path": "native/android/app/src/cpp/jsiInstaller.cpp",
"diff": "#include <jsi/jsi.h>\n#include <fbjni/fbjni.h>\n#include <CallInvokerHolder.h>\n-#include \"DraftNativeModule.h\"\n+#include \"CommCoreModule.h\"\n#include \"SQLiteManager.h\"\n#include \"jniHelpers.h\"\n@@ -23,18 +23,15 @@ public:\n) {\njsi::Runtime *rt = (jsi::Runtime *)jsContext;\nauto jsCallInvoker = jsCallInvokerHolder->cthis()->getCallInvoker();\n- std::shared_ptr<comm::DraftNativeModule> nativeModule =\n- std::make_shared<comm::DraftNativeModule>(jsCallInvoker);\n+ std::shared_ptr<comm::CommCoreModule> nativeModule =\n+ std::make_shared<comm::CommCoreModule>(jsCallInvoker);\n- // patch runtime\n- // - add draft module\nrt->global().setProperty(\n*rt,\n- jsi::PropNameID::forAscii(*rt, \"draftModule\"),\n+ jsi::PropNameID::forAscii(*rt, \"CommCoreModule\"),\njsi::Object::createFromHostObject(*rt, nativeModule)\n);\n- // set sqlite file path\njni::local_ref<jni::JObject> sqliteFilePathObj =\nadditionalParameters.get(\"sqliteFilePath\");\ncomm::SQLiteManager::sqliteFilePath = sqliteFilePathObj->toString();\n"
},
{
"change_type": "MODIFY",
"old_path": "native/codegen/src/index.js",
"new_path": "native/codegen/src/index.js",
"diff": "@@ -7,7 +7,7 @@ import path from 'path';\nimport codeGen from './CodeGen.js';\n('use strict');\n-const schemaInPath = path.resolve('./schema/DraftSchema.js');\n+const schemaInPath = path.resolve('./schema/CommCoreModuleSchema.js');\nconst outPath = path.resolve('./CommonCpp/NativeModules');\ncodeGen('comm', schemaInPath, ['cpp', 'h'], outPath);\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal.xcodeproj/project.pbxproj",
"new_path": "native/ios/SquadCal.xcodeproj/project.pbxproj",
"diff": "54B457A7302F03F835EC5D92 /* libPods-SquadCal.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A75435FBAC0720E8BE857F55 /* libPods-SquadCal.a */; };\n711B408425DA97F9005F8F06 /* dummy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F26E81B24440D87004049C6 /* dummy.swift */; };\n7173BEB22627035D0089BF7A /* NativeModules.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7173BE9F2627035D0089BF7A /* NativeModules.cpp */; };\n- 7173BEB32627035D0089BF7A /* DraftNativeModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7173BEA02627035D0089BF7A /* DraftNativeModule.cpp */; };\n+ 7173BEB32627035D0089BF7A /* CommCoreModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7173BEA02627035D0089BF7A /* CommCoreModule.cpp */; };\n7173BEB62627035D0089BF7A /* SQLiteManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7173BEAA2627035D0089BF7A /* SQLiteManager.cpp */; };\n71CA4AEC262F236100835C89 /* Tools.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71CA4AEB262F236100835C89 /* Tools.mm */; };\n71CA4A64262DA8E500835C89 /* Logger.mm in Sources */ = {isa = PBXBuildFile; fileRef = 71CA4A63262DA8E500835C89 /* Logger.mm */; };\n5D92D07F9695E31E05F88732 /* Pods-SquadCal.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = \"Pods-SquadCal.release.xcconfig\"; path = \"Target Support Files/Pods-SquadCal/Pods-SquadCal.release.xcconfig\"; sourceTree = \"<group>\"; };\n711CF80E25DC096000A00FBD /* libFolly.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libFolly.a; sourceTree = BUILT_PRODUCTS_DIR; };\n7173BE9F2627035D0089BF7A /* NativeModules.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NativeModules.cpp; sourceTree = \"<group>\"; };\n- 7173BEA02627035D0089BF7A /* DraftNativeModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DraftNativeModule.cpp; sourceTree = \"<group>\"; };\n+ 7173BEA02627035D0089BF7A /* CommCoreModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommCoreModule.cpp; sourceTree = \"<group>\"; };\n7173BEA12627035D0089BF7A /* NativeModules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeModules.h; sourceTree = \"<group>\"; };\n- 7173BEA22627035D0089BF7A /* DraftNativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DraftNativeModule.h; sourceTree = \"<group>\"; };\n+ 7173BEA22627035D0089BF7A /* CommCoreModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommCoreModule.h; sourceTree = \"<group>\"; };\n7173BEA92627035D0089BF7A /* DatabaseManagerInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseManagerInterface.h; sourceTree = \"<group>\"; };\n7173BEAA2627035D0089BF7A /* SQLiteManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteManager.cpp; sourceTree = \"<group>\"; };\n7173BEAB2627035D0089BF7A /* SQLiteManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteManager.h; sourceTree = \"<group>\"; };\nisa = PBXGroup;\nchildren = (\n7173BE9F2627035D0089BF7A /* NativeModules.cpp */,\n- 7173BEA02627035D0089BF7A /* DraftNativeModule.cpp */,\n+ 7173BEA02627035D0089BF7A /* CommCoreModule.cpp */,\n7173BEA12627035D0089BF7A /* NativeModules.h */,\n- 7173BEA22627035D0089BF7A /* DraftNativeModule.h */,\n+ 7173BEA22627035D0089BF7A /* CommCoreModule.h */,\n);\npath = NativeModules;\nsourceTree = \"<group>\";\nbuildActionMask = 2147483647;\nfiles = (\n71CA4AEC262F236100835C89 /* Tools.mm in Sources */,\n- 7173BEB32627035D0089BF7A /* DraftNativeModule.cpp in Sources */,\n+ 7173BEB32627035D0089BF7A /* CommCoreModule.cpp in Sources */,\n13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,\n71CA4A64262DA8E500835C89 /* Logger.mm in Sources */,\n711B408425DA97F9005F8F06 /* dummy.swift in Sources */,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/AppDelegate.mm",
"new_path": "native/ios/SquadCal/AppDelegate.mm",
"diff": "#import <string>\n#import \"Tools.h\"\n-#import \"DraftNativeModule.h\"\n+#import \"CommCoreModule.h\"\n#import \"SQLiteManager.h\"\n#ifdef FB_SONARKIT_ENABLED\n@@ -143,12 +143,12 @@ using Runtime = facebook::jsi::Runtime;\n}\n__typeof(self) strongSelf = weakSelf;\nif (strongSelf) {\n- std::shared_ptr<comm::DraftNativeModule> nativeModule =\n- std::make_shared<comm::DraftNativeModule>(bridge.jsCallInvoker);\n+ std::shared_ptr<comm::CommCoreModule> nativeModule =\n+ std::make_shared<comm::CommCoreModule>(bridge.jsCallInvoker);\nrt.global().setProperty(\nrt,\n- facebook::jsi::PropNameID::forAscii(rt, \"draftModule\"),\n+ facebook::jsi::PropNameID::forAscii(rt, \"CommCoreModule\"),\nfacebook::jsi::Object::createFromHostObject(rt, nativeModule)\n);\n"
},
{
"change_type": "RENAME",
"old_path": "native/schema/DraftSchema.js",
"new_path": "native/schema/CommCoreModuleSchema.js",
"diff": ""
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [jsi] rename native module
Summary: rename native module exposed to js from `draftModule` to `CommCoreModule`
Test Plan: use `global.CommCoreModule.getDraft` and `global.CommCoreModule.updateDraft`
Reviewers: palys-swm, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1043 |
129,184 | 26.04.2021 21:40:20 | 14,400 | 0bc0a9f4729e284ec24db54deb06ed63ced30146 | [landing] responsive font-sizes
Summary: Sets different font-sizes at each of the relevant breakpoints. The values can be adjusted based on feedback.
Test Plan: `Inspect Element` on Safari/Chrome confirms that the font-sizes are as expected at various widths.
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.css",
"new_path": "landing/landing.css",
"diff": "@@ -17,12 +17,12 @@ h1.title {\npadding-left: 60px;\n}\n-span.purple {\n- color: #7e57c2;\n+h1 {\n+ font-size: 58px;\n}\n-h2.lede {\n- font-size: 56px;\n+span.purple {\n+ color: #7e57c2;\n}\nh2 {\n@@ -49,6 +49,20 @@ div.grid {\n'footer_logo subscribe_updates';\n}\n+@media (max-width: 1499px) {\n+ h1 {\n+ font-size: 42px;\n+ }\n+\n+ h2 {\n+ font-size: 38px;\n+ }\n+\n+ p {\n+ font-size: 20px;\n+ }\n+}\n+\n@media (max-width: 1099px) {\ndiv.grid {\ndisplay: grid;\n@@ -66,6 +80,18 @@ div.grid {\n'subscribe_updates'\n'footer_logo';\n}\n+\n+ h1 {\n+ font-size: 32px;\n+ }\n+\n+ h2 {\n+ font-size: 26px;\n+ }\n+\n+ p {\n+ font-size: 18px;\n+ }\n}\ndiv.hero_copy {\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "@@ -55,10 +55,10 @@ function Landing(): React.Node {\n></lottie-player>\n</div>\n<div className={css.hero_copy}>\n- <h2 className={css.lede}>\n+ <h1>\nReclaim your\n<span className={css.purple}> digital identity.</span>\n- </h2>\n+ </h1>\n<p>\nThe internet is broken today. Private user data is owned by\nmega-corporations and farmed for their benefit.\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] responsive font-sizes
Summary: Sets different font-sizes at each of the relevant breakpoints. The values can be adjusted based on feedback.
Test Plan: `Inspect Element` on Safari/Chrome confirms that the font-sizes are as expected at various widths.
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1057 |
129,184 | 27.04.2021 09:30:55 | 14,400 | f88b042da3a9c3d6df05636b71bf5d9db0e40fc7 | [landing] Set maximum column width to 540px at 1099px breakpoint
Summary:
This change fixes the margin issue with the 1099px breakpoint discussed yesterday.
Here's what it looks like:
Test Plan: Looks good on Safari/Firefox
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.css",
"new_path": "landing/landing.css",
"diff": "@@ -69,7 +69,8 @@ div.grid {\npadding-left: 60px;\npadding-right: 60px;\nrow-gap: 2em;\n- grid-template-columns: 1fr;\n+ grid-template-columns: minmax(auto, 540px);\n+ justify-content: center;\ngrid-template-areas:\n'hero_image'\n'hero_copy'\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/landing-handler.js",
"new_path": "server/src/responders/landing-handler.js",
"diff": "@@ -99,6 +99,7 @@ async function landingResponder(req: $Request, res: $Response) {\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\" />\n+ <meta name=\"viewport\" content=\"width=device-width\" />\n<title>Comm</title>\n<base href=\"${basePath}\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"${fontsURL}\" />\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Set maximum column width to 540px at 1099px breakpoint
Summary:
This change fixes the margin issue with the 1099px breakpoint discussed yesterday.
Here's what it looks like: https://blob.sh/atul/1610.png
Test Plan: Looks good on Safari/Firefox
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1059 |
129,184 | 27.04.2021 09:52:01 | 14,400 | ece948b938ec1ad610257d879b93560d04e45952 | [landing] Responsive subscription form
Summary:
two-row subscription form at 1099px breakpoint
here's what it looks like:
and at higher breakpoints:
Test Plan: looks good on safari/firefox
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.css",
"new_path": "landing/landing.css",
"diff": "@@ -38,6 +38,7 @@ div.grid {\npadding-top: 20px;\npadding-left: 60px;\npadding-right: 60px;\n+ padding-bottom: 40px;\nrow-gap: 14em;\ncolumn-gap: 4em;\ngrid-template-rows: 1fr 1fr 1fr 1/6fr;\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/subscription-form.css",
"new_path": "landing/subscription-form.css",
"diff": "@@ -45,3 +45,25 @@ input.email_input {\nborder-top-right-radius: 0px;\nborder-bottom-right-radius: 0px;\n}\n+\n+@media (max-width: 1099px) {\n+ form {\n+ display: block;\n+ }\n+ .button {\n+ width: 100%;\n+ height: 50px;\n+ border: none;\n+ border-radius: 8px;\n+ }\n+\n+ input.email_input {\n+ width: 100%;\n+ height: 50px;\n+ border-radius: 8px;\n+ margin-bottom: 0.5em;\n+ box-sizing: border-box;\n+\n+ border: 1px solid white;\n+ }\n+}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Responsive subscription form
Summary:
two-row subscription form at 1099px breakpoint
here's what it looks like: https://blob.sh/atul/c586.png
and at higher breakpoints: https://blob.sh/atul/1601.png
Test Plan: looks good on safari/firefox
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1060 |
129,184 | 28.04.2021 12:50:04 | 14,400 | e95b243a5b4f530a048b90c9fa646dbdf03f0969 | [server] Email subscription endpoint
Summary: Endpoint for email subscriptions to be hit by form on landing page.
Test Plan: Modified user-actions:requestAccess to hit `subscribe-email` instead of `request-access` and logged that the endpoint was being hit.
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "lib/types/account-types.js",
"new_path": "lib/types/account-types.js",
"diff": "@@ -150,3 +150,7 @@ export type AccessRequest = {|\n+email: string,\n+platform: DeviceType,\n|};\n+\n+export type EmailSubscriptionRequest = {|\n+ +email: string,\n+|};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/emails/subscribe-email-updates.js",
"diff": "+// @flow\n+\n+import * as React from 'react';\n+import { Item, Span, renderEmail } from 'react-html-email';\n+\n+import ashoat from 'lib/facts/ashoat';\n+import type { EmailSubscriptionRequest } from 'lib/types/account-types';\n+\n+import sendmail from './sendmail';\n+import Template from './template.react';\n+\n+async function sendEmailSubscriptionRequestToAshoat(\n+ request: EmailSubscriptionRequest,\n+): Promise<void> {\n+ const title = 'Somebody wants to learn more about Comm!';\n+ const email = (\n+ <Template title={title}>\n+ <Item align=\"left\">\n+ <Span>{`${request.email} wants to learn more about Comm.`}</Span>\n+ </Item>\n+ </Template>\n+ );\n+ const html = renderEmail(email);\n+\n+ await sendmail.sendMail({\n+ from: 'no-reply@squadcal.org',\n+ to: ashoat.email,\n+ subject: title,\n+ html,\n+ });\n+}\n+\n+export { sendEmailSubscriptionRequestToAshoat };\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "server/src/responders/comm-landing-responders.js",
"diff": "+// @flow\n+\n+import type { $Response, $Request } from 'express';\n+import t from 'tcomb';\n+\n+import { type EmailSubscriptionRequest } from 'lib/types/account-types';\n+import { ServerError } from 'lib/utils/errors';\n+\n+import { sendEmailSubscriptionRequestToAshoat } from '../emails/subscribe-email-updates';\n+import { checkInputValidator, tShape } from '../utils/validation-utils';\n+\n+const emailSubscriptionInputValidator = tShape({\n+ email: t.String,\n+});\n+\n+async function emailSubscriptionResponder(\n+ req: $Request,\n+ res: $Response,\n+): Promise<void> {\n+ try {\n+ if (!req.body || typeof req.body !== 'object') {\n+ throw new ServerError('invalid_parameters');\n+ }\n+ const input: any = req.body;\n+ checkInputValidator(emailSubscriptionInputValidator, input);\n+ const subscriptionRequest: EmailSubscriptionRequest = input;\n+ await sendEmailSubscriptionRequestToAshoat(subscriptionRequest);\n+ res.json({ success: true });\n+ } catch {\n+ res.json({ success: false });\n+ }\n+}\n+\n+export { emailSubscriptionResponder };\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/server.js",
"new_path": "server/src/server.js",
"diff": "@@ -8,6 +8,7 @@ import os from 'os';\nimport './cron/cron';\nimport { jsonEndpoints } from './endpoints';\n+import { emailSubscriptionResponder } from './responders/comm-landing-responders';\nimport {\njsonHandler,\ndownloadHandler,\n@@ -82,6 +83,8 @@ if (cluster.isMaster) {\n);\n}\n+ router.post('/commlanding/subscribe_email', emailSubscriptionResponder);\n+\nrouter.get(\n'/download_error_report/:reportID',\ndownloadHandler(errorReportDownloadResponder),\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] Email subscription endpoint
Summary: Endpoint for email subscriptions to be hit by form on landing page.
Test Plan: Modified user-actions:requestAccess to hit `subscribe-email` instead of `request-access` and logged that the endpoint was being hit.
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1062 |
129,184 | 28.04.2021 13:21:08 | 14,400 | 90a010351d2feb3def1b0f6e5e223b2d1f63abc6 | [server] validate email addresses in `user-responders` and `comm-landing-responders`
Summary: Introduce `tEmail` to validate email addresses with tcomb
Test Plan: Tested with `access-request` and `subscribe-email`
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/account-utils.js",
"new_path": "lib/shared/account-utils.js",
"diff": "@@ -15,6 +15,8 @@ const validUsernameRegexString = `^[a-zA-Z0-9][a-zA-Z0-9-_]{5,${\n}}$`;\nconst validUsernameRegex = new RegExp(validUsernameRegexString);\n+// usernames used to be less restrictive (eg single chars were allowed)\n+// use oldValidUsername when dealing with existing accounts\nconst oldValidUsernameRegexString = '[a-zA-Z0-9-_]+';\nconst oldValidUsernameRegex = new RegExp(`^${oldValidUsernameRegexString}$`);\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/comm-landing-responders.js",
"new_path": "server/src/responders/comm-landing-responders.js",
"diff": "// @flow\nimport type { $Response, $Request } from 'express';\n-import t from 'tcomb';\nimport { type EmailSubscriptionRequest } from 'lib/types/account-types';\nimport { ServerError } from 'lib/utils/errors';\nimport { sendEmailSubscriptionRequestToAshoat } from '../emails/subscribe-email-updates';\n-import { checkInputValidator, tShape } from '../utils/validation-utils';\n+import { checkInputValidator, tShape, tEmail } from '../utils/validation-utils';\nconst emailSubscriptionInputValidator = tShape({\n- email: t.String,\n+ email: tEmail,\n});\nasync function emailSubscriptionResponder(\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/responders/user-responders.js",
"new_path": "server/src/responders/user-responders.js",
"diff": "@@ -53,6 +53,8 @@ import {\ntPlatformDetails,\ntDeviceType,\ntPassword,\n+ tEmail,\n+ tOldValidUsername,\n} from '../utils/validation-utils';\nimport {\nentryQueryInputValidator,\n@@ -81,7 +83,7 @@ async function userSubscriptionUpdateResponder(\nconst accountUpdateInputValidator = tShape({\nupdatedFields: tShape({\n- email: t.maybe(t.String),\n+ email: t.maybe(tEmail),\npassword: t.maybe(tPassword),\n}),\ncurrentPassword: tPassword,\n@@ -102,7 +104,7 @@ async function sendVerificationEmailResponder(viewer: Viewer): Promise<void> {\n}\nconst resetPasswordRequestInputValidator = tShape({\n- usernameOrEmail: t.String,\n+ usernameOrEmail: t.union([tEmail, tOldValidUsername]),\n});\nasync function sendPasswordResetEmailResponder(\n@@ -156,7 +158,7 @@ const deviceTokenUpdateRequestInputValidator = tShape({\nconst registerRequestInputValidator = tShape({\nusername: t.String,\n- email: t.String,\n+ email: tEmail,\npassword: tPassword,\ncalendarQuery: t.maybe(newEntryQueryInputValidator),\ndeviceTokenUpdateRequest: t.maybe(deviceTokenUpdateRequestInputValidator),\n@@ -296,7 +298,7 @@ async function passwordUpdateResponder(\n}\nconst accessRequestInputValidator = tShape({\n- email: t.String,\n+ email: tEmail,\nplatform: tDeviceType,\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/utils/validation-utils.js",
"new_path": "server/src/utils/validation-utils.js",
"diff": "import t from 'tcomb';\n+import {\n+ validEmailRegex,\n+ oldValidUsernameRegex,\n+} from 'lib/shared/account-utils';\nimport { ServerError } from 'lib/utils/errors';\nimport { verifyClientSupported } from '../session/version';\n@@ -45,6 +49,8 @@ const tPlatformDetails = tShape({\n});\nconst tPassword = t.refinement(t.String, (password: string) => password);\nconst tCookie = tRegex(/^(user|anonymous)=[0-9]+:[0-9a-f]+$/);\n+const tEmail = tRegex(validEmailRegex);\n+const tOldValidUsername = tRegex(oldValidUsernameRegex);\nasync function validateInput(viewer: Viewer, inputValidator: *, input: *) {\nif (!viewer.isSocket) {\n@@ -201,6 +207,8 @@ export {\ntPlatformDetails,\ntPassword,\ntCookie,\n+ tEmail,\n+ tOldValidUsername,\nvalidateInput,\ncheckInputValidator,\ncheckClientSupported,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [server] validate email addresses in `user-responders` and `comm-landing-responders`
Summary: Introduce `tEmail` to validate email addresses with tcomb
Test Plan: Tested with `access-request` and `subscribe-email`
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1064 |
129,184 | 29.04.2021 14:48:13 | 14,400 | 6f52870b6edc0b3ee00002d8ee88af953ade45ed | [lib] Modify `lib/facts/ashoat.json`
Summary: Swap out gmail for comm.app address and add `landing_email` entry. Use `landing_email` in `subscribe-email-updates`.
Test Plan: NA
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "lib/facts/ashoat.json",
"new_path": "lib/facts/ashoat.json",
"diff": "{\n\"id\": \"256\",\n- \"email\": \"ashoat@gmail.com\"\n+ \"email\": \"ashoat@gmail.com\",\n+ \"landing_email\": \"ashoat+landing@comm.app\"\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/emails/access-request.js",
"new_path": "server/src/emails/access-request.js",
"diff": "@@ -36,7 +36,7 @@ async function sendAccessRequestEmailToAshoat(\nawait sendmail.sendMail({\nfrom: 'no-reply@squadcal.org',\n- to: ashoat.email,\n+ to: ashoat.landing_email,\nsubject: title,\nhtml,\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/emails/subscribe-email-updates.js",
"new_path": "server/src/emails/subscribe-email-updates.js",
"diff": "@@ -24,7 +24,7 @@ async function sendEmailSubscriptionRequestToAshoat(\nawait sendmail.sendMail({\nfrom: 'no-reply@squadcal.org',\n- to: ashoat.email,\n+ to: ashoat.landing_email,\nsubject: title,\nhtml,\n});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Modify `lib/facts/ashoat.json`
Summary: Swap out gmail for comm.app address and add `landing_email` entry. Use `landing_email` in `subscribe-email-updates`.
Test Plan: NA
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1077 |
129,184 | 03.05.2021 11:37:38 | 25,200 | 34f5c52df5af22617874eb670ec4726490e5f2e9 | [landing] non breaking space for headline
Summary: We discussed how we didn't want the purple 'digital identity' text to be broken up into separate lines. Using non-breaking space addresses this.
Test Plan: Looks as expected on Safari/Chrome/Firefox
Reviewers: ashoat
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "@@ -57,7 +57,7 @@ function Landing(): React.Node {\n<div className={css.hero_copy}>\n<h1>\nReclaim your\n- <span className={css.purple}> digital identity.</span>\n+ <span className={css.purple}> digital identity.</span>\n</h1>\n<p>\nThe internet is broken today. Private user data is owned by\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] non breaking space for headline
Summary: We discussed how we didn't want the purple 'digital identity' text to be broken up into separate lines. Using non-breaking space addresses this.
Test Plan: Looks as expected on Safari/Chrome/Firefox
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1092 |
129,187 | 01.05.2021 09:22:00 | 14,400 | 76924da84cd6f40f9f88aa9c869783471b1d79ab | [native] Fix ChatThreadList search to top when active
Summary: This diff solves this [Notion issue](https://www.notion.so/commapp/ThreadList-scrolls-to-top-when-item-pressed-c60cd69ababd4b8bba0b957ff8b85de5), and is a better UX anyways.
Test Plan: Tested it on iOS and Android and made sure it's smooth
Reviewers: palys-swm
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "import invariant from 'invariant';\nimport _sum from 'lodash/fp/sum';\nimport * as React from 'react';\n-import { View, FlatList, Platform, TextInput } from 'react-native';\n+import {\n+ View,\n+ FlatList,\n+ Platform,\n+ TextInput,\n+ TouchableWithoutFeedback,\n+} from 'react-native';\nimport { FloatingAction } from 'react-native-floating-action';\nimport IonIcon from 'react-native-vector-icons/Ionicons';\nimport { createSelector } from 'reselect';\n@@ -84,7 +90,9 @@ type Props = {|\n// async functions that hit server APIs\n+searchUsers: (usernamePrefix: string) => Promise<UserSearchResult>,\n|};\n+type SearchStatus = 'inactive' | 'activating' | 'active';\ntype State = {|\n+ +searchStatus: SearchStatus,\n+searchText: string,\n+threadsSearchResults: Set<string>,\n+usersSearchResults: $ReadOnlyArray<GlobalAccountUserInfo>,\n@@ -93,6 +101,7 @@ type State = {|\ntype PropsAndState = {| ...Props, ...State |};\nclass ChatThreadList extends React.PureComponent<Props, State> {\nstate: State = {\n+ searchStatus: 'inactive',\nsearchText: '',\nthreadsSearchResults: new Set(),\nusersSearchResults: [],\n@@ -126,6 +135,18 @@ class ChatThreadList extends React.PureComponent<Props, State> {\ntabNavigation.removeListener('tabPress', this.onTabPress);\n}\n+ componentDidUpdate(prevProps: Props, prevState: State) {\n+ const { flatList } = this;\n+ if (!flatList) {\n+ return;\n+ }\n+ const { searchStatus } = this.state;\n+ const prevSearchStatus = prevState.searchStatus;\n+ if (searchStatus === 'activating' && prevSearchStatus === 'inactive') {\n+ flatList.scrollToOffset({ offset: 0, animated: true });\n+ }\n+ }\n+\nonTabPress = () => {\nif (!this.props.navigation.isFocused()) {\nreturn;\n@@ -137,17 +158,53 @@ class ChatThreadList extends React.PureComponent<Props, State> {\n}\n};\n- renderItem = (row: { item: Item }) => {\n- const item = row.item;\n- if (item.type === 'search') {\n+ onSearchFocus = () => {\n+ if (this.state.searchStatus !== 'inactive') {\n+ return;\n+ }\n+ if (this.scrollPos === 0) {\n+ this.setState({ searchStatus: 'active' });\n+ } else {\n+ this.setState({ searchStatus: 'activating' });\n+ }\n+ };\n+\n+ onSearchBlur = () => {\n+ if (this.state.searchStatus !== 'active') {\n+ return;\n+ }\n+ const { flatList } = this;\n+ flatList && flatList.scrollToOffset({ offset: 0, animated: false });\n+ this.setState({ searchStatus: 'inactive' });\n+ };\n+\n+ renderSearch(additionalProps?: $Shape<React.ElementConfig<typeof Search>>) {\nreturn (\n+ <View style={this.props.styles.searchContainer}>\n<Search\nsearchText={this.state.searchText}\nonChangeText={this.onChangeSearchText}\ncontainerStyle={this.props.styles.search}\n+ onBlur={this.onSearchBlur}\nplaceholder=\"Search threads\"\nref={this.searchInputRef}\n+ {...additionalProps}\n/>\n+ </View>\n+ );\n+ }\n+\n+ searchInputRef = (searchInput: ?React.ElementRef<typeof TextInput>) => {\n+ this.searchInput = searchInput;\n+ };\n+\n+ renderItem = (row: { item: Item }) => {\n+ const item = row.item;\n+ if (item.type === 'search') {\n+ return (\n+ <TouchableWithoutFeedback onPress={this.onSearchFocus}>\n+ {this.renderSearch({ active: false })}\n+ </TouchableWithoutFeedback>\n);\n}\nif (item.type === 'empty') {\n@@ -165,10 +222,6 @@ class ChatThreadList extends React.PureComponent<Props, State> {\n);\n};\n- searchInputRef = (searchInput: ?React.ElementRef<typeof TextInput>) => {\n- this.searchInput = searchInput;\n- };\n-\nstatic keyExtractor(item: Item) {\nif (item.type === 'chatThreadItem') {\nreturn item.threadInfo.id;\n@@ -212,12 +265,14 @@ class ChatThreadList extends React.PureComponent<Props, State> {\nlistDataSelector = createSelector(\n(propsAndState: PropsAndState) => propsAndState.chatListData,\n+ (propsAndState: PropsAndState) => propsAndState.searchStatus,\n(propsAndState: PropsAndState) => propsAndState.searchText,\n(propsAndState: PropsAndState) => propsAndState.threadsSearchResults,\n(propsAndState: PropsAndState) => propsAndState.emptyItem,\n(propsAndState: PropsAndState) => propsAndState.usersSearchResults,\n(\nreduxChatListData: $ReadOnlyArray<ChatThreadItem>,\n+ searchStatus: SearchStatus,\nsearchText: string,\nthreadsSearchResults: Set<string>,\nemptyItem?: React.ComponentType<{||}>,\n@@ -264,7 +319,11 @@ class ChatThreadList extends React.PureComponent<Props, State> {\nchatItems.push({ type: 'empty', emptyItem });\n}\n- return [{ type: 'search', searchText }, ...chatItems];\n+ if (searchStatus === 'inactive' || searchStatus === 'activating') {\n+ chatItems.unshift({ type: 'search', searchText });\n+ }\n+\n+ return chatItems;\n},\n);\n@@ -273,7 +332,7 @@ class ChatThreadList extends React.PureComponent<Props, State> {\n}\nrender() {\n- let floatingAction = null;\n+ let floatingAction;\nif (Platform.OS === 'android') {\nfloatingAction = (\n<FloatingAction\n@@ -284,10 +343,18 @@ class ChatThreadList extends React.PureComponent<Props, State> {\n/>\n);\n}\n+ let fixedSearch;\n+ const { searchStatus } = this.state;\n+ if (searchStatus === 'active') {\n+ fixedSearch = this.renderSearch({ autoFocus: true });\n+ }\n+ const scrollEnabled =\n+ searchStatus === 'inactive' || searchStatus === 'active';\n// this.props.viewerID is in extraData since it's used by MessagePreview\n// within ChatThreadListItem\nreturn (\n<View style={this.props.styles.container}>\n+ {fixedSearch}\n<FlatList\ndata={this.listData}\nrenderItem={this.renderItem}\n@@ -301,6 +368,8 @@ class ChatThreadList extends React.PureComponent<Props, State> {\nonScroll={this.onScroll}\nstyle={this.props.styles.flatList}\nindicatorStyle={this.props.indicatorStyle}\n+ scrollEnabled={scrollEnabled}\n+ removeClippedSubviews={true}\nref={this.flatListRef}\n/>\n{floatingAction}\n@@ -313,7 +382,14 @@ class ChatThreadList extends React.PureComponent<Props, State> {\n};\nonScroll = (event: { +nativeEvent: { +contentOffset: { +y: number } } }) => {\n+ const oldScrollPos = this.scrollPos;\nthis.scrollPos = event.nativeEvent.contentOffset.y;\n+ if (this.scrollPos !== 0 || oldScrollPos === 0) {\n+ return;\n+ }\n+ if (this.state.searchStatus === 'activating') {\n+ this.setState({ searchStatus: 'active' });\n+ }\n};\nasync searchUsers(usernamePrefix: string) {\n@@ -389,6 +465,9 @@ const unboundStyles = {\ncontainer: {\nflex: 1,\n},\n+ searchContainer: {\n+ backgroundColor: 'listBackground',\n+ },\nsearch: {\nmarginBottom: 8,\nmarginHorizontal: 12,\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Fix ChatThreadList search to top when active
Summary: This diff solves this [Notion issue](https://www.notion.so/commapp/ThreadList-scrolls-to-top-when-item-pressed-c60cd69ababd4b8bba0b957ff8b85de5), and is a better UX anyways.
Test Plan: Tested it on iOS and Android and made sure it's smooth
Reviewers: palys-swm
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1083 |
129,187 | 02.05.2021 17:01:01 | 14,400 | 980375f24576d349ef07af9fc25d0cce283d662e | [native]
Summary: Fixes [this issue](https://github.com/ds300/patch-package/issues/166)
Test Plan:
1. Make sure `patch-package react-native` works without needing to manually patch `patch-package`
2. Make sure `yarn cleaninstall` works and still patches correctly
Reviewers: palys-swm
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"jest\": \"^25.1.0\",\n\"jetifier\": \"^1.6.4\",\n\"metro-react-native-babel-preset\": \"^0.59.0\",\n- \"patch-package\": \"^6.2.2\",\n+ \"patch-package\": \"^6.4.7\",\n\"postinstall-postinstall\": \"^2.0.0\",\n\"react-native-flipper\": \"^0.79.1\",\n\"react-test-renderer\": \"16.13.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -8118,13 +8118,12 @@ find-versions@^3.2.0:\ndependencies:\nsemver-regex \"^2.0.0\"\n-find-yarn-workspace-root@^1.2.1:\n- version \"1.2.1\"\n- resolved \"https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-1.2.1.tgz#40eb8e6e7c2502ddfaa2577c176f221422f860db\"\n- integrity sha512-dVtfb0WuQG+8Ag2uWkbG79hOUzEsRrhBzgfn86g2sJPkzmcpGdghbNTfUKGTxymFrY/tLIodDzLoW9nOJ4FY8Q==\n+find-yarn-workspace-root@^2.0.0:\n+ version \"2.0.0\"\n+ resolved \"https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd\"\n+ integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==\ndependencies:\n- fs-extra \"^4.0.3\"\n- micromatch \"^3.1.4\"\n+ micromatch \"^4.0.2\"\nfindup-sync@3.0.0:\nversion \"3.0.0\"\n@@ -8361,15 +8360,6 @@ fs-extra@^1.0.0:\njsonfile \"^2.1.0\"\nklaw \"^1.0.0\"\n-fs-extra@^4.0.3:\n- version \"4.0.3\"\n- resolved \"https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94\"\n- integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==\n- dependencies:\n- graceful-fs \"^4.1.2\"\n- jsonfile \"^4.0.0\"\n- universalify \"^0.1.0\"\n-\nfs-extra@^7.0.1:\nversion \"7.0.1\"\nresolved \"https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9\"\n@@ -13288,6 +13278,14 @@ open@^6.2.0:\ndependencies:\nis-wsl \"^1.1.0\"\n+open@^7.4.2:\n+ version \"7.4.2\"\n+ resolved \"https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321\"\n+ integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==\n+ dependencies:\n+ is-docker \"^2.0.0\"\n+ is-wsl \"^2.1.1\"\n+\nopencollective-postinstall@^2.0.0, opencollective-postinstall@^2.0.2:\nversion \"2.0.2\"\nresolved \"https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89\"\n@@ -13647,19 +13645,20 @@ pascalcase@^0.1.1:\nresolved \"https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14\"\nintegrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=\n-patch-package@^6.2.2:\n- version \"6.2.2\"\n- resolved \"https://registry.yarnpkg.com/patch-package/-/patch-package-6.2.2.tgz#71d170d650c65c26556f0d0fbbb48d92b6cc5f39\"\n- integrity sha512-YqScVYkVcClUY0v8fF0kWOjDYopzIM8e3bj/RU1DPeEF14+dCGm6UeOYm4jvCyxqIEQ5/eJzmbWfDWnUleFNMg==\n+patch-package@^6.4.7:\n+ version \"6.4.7\"\n+ resolved \"https://registry.yarnpkg.com/patch-package/-/patch-package-6.4.7.tgz#2282d53c397909a0d9ef92dae3fdeb558382b148\"\n+ integrity sha512-S0vh/ZEafZ17hbhgqdnpunKDfzHQibQizx9g8yEf5dcVk3KOflOfdufRXQX8CSEkyOQwuM/bNz1GwKvFj54kaQ==\ndependencies:\n\"@yarnpkg/lockfile\" \"^1.1.0\"\nchalk \"^2.4.2\"\ncross-spawn \"^6.0.5\"\n- find-yarn-workspace-root \"^1.2.1\"\n+ find-yarn-workspace-root \"^2.0.0\"\nfs-extra \"^7.0.1\"\nis-ci \"^2.0.0\"\nklaw-sync \"^6.0.0\"\nminimist \"^1.2.0\"\n+ open \"^7.4.2\"\nrimraf \"^2.6.3\"\nsemver \"^5.6.0\"\nslash \"^2.0.0\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] patch-package@6.4.7
Summary: Fixes [this issue](https://github.com/ds300/patch-package/issues/166)
Test Plan:
1. Make sure `patch-package react-native` works without needing to manually patch `patch-package`
2. Make sure `yarn cleaninstall` works and still patches correctly
Reviewers: palys-swm
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1086 |
129,187 | 02.05.2021 14:59:02 | 14,400 | 560257f83ce1139b41c65c710b11ef9ccdbc9035 | [native]
Summary: This is necessary to fix the build with XCode 12.5.
Test Plan: In combination with D1087 and D1089, confirm that I can build iOS as (dev, release, archive) on (simulator, device
Reviewers: palys-swm
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/ios/Podfile.lock",
"new_path": "native/ios/Podfile.lock",
"diff": "@@ -115,10 +115,10 @@ PODS:\n- libwebp/mux (1.1.0):\n- libwebp/demux\n- libwebp/webp (1.1.0)\n- - lottie-ios (3.1.3)\n- - lottie-react-native (3.2.1):\n- - lottie-ios (~> 3.1.3)\n- - React\n+ - lottie-ios (3.1.8)\n+ - lottie-react-native (4.0.2):\n+ - lottie-ios (~> 3.1.8)\n+ - React-Core\n- mobile-ffmpeg-min (4.3.1.LTS)\n- OpenSSL-Universal (1.1.180)\n- RCTRequired (0.63.4)\n@@ -736,8 +736,8 @@ SPEC CHECKSUMS:\nglog: 40a13f7840415b9a77023fbcae0f1e6f43192af3\nlibevent: 4049cae6c81cdb3654a443be001fb9bdceff7913\nlibwebp: 946cb3063cea9236285f7e9a8505d806d30e07f3\n- lottie-ios: 496ac5cea1bbf1a7bd1f1f472f3232eb1b8d744b\n- lottie-react-native: b123a79529cc732201091f585c62c89bb4747252\n+ lottie-ios: 48fac6be217c76937e36e340e2d09cf7b10b7f5f\n+ lottie-react-native: 4dff8fe8d10ddef9e7880e770080f4a56121397e\nmobile-ffmpeg-min: d5d22dcef5c8ec56f771258f1f5be245d914f193\nOpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b\nRCTRequired: 082f10cd3f905d6c124597fd1c14f6f2655ff65e\n"
},
{
"change_type": "MODIFY",
"old_path": "native/package.json",
"new_path": "native/package.json",
"diff": "\"invariant\": \"^2.2.4\",\n\"lib\": \"0.0.1\",\n\"lodash\": \"^4.17.19\",\n- \"lottie-ios\": \"3.1.3\",\n- \"lottie-react-native\": \"^3.2.1\",\n+ \"lottie-ios\": \"3.1.8\",\n+ \"lottie-react-native\": \"^4.0.2\",\n\"md5\": \"^2.2.1\",\n\"react\": \"16.13.1\",\n\"react-native\": \"0.63.4\",\n"
},
{
"change_type": "MODIFY",
"old_path": "yarn.lock",
"new_path": "yarn.lock",
"diff": "@@ -11788,20 +11788,19 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3\ndependencies:\njs-tokens \"^3.0.0 || ^4.0.0\"\n-lottie-ios@3.1.3, lottie-ios@^3.1.3:\n- version \"3.1.3\"\n- resolved \"https://registry.yarnpkg.com/lottie-ios/-/lottie-ios-3.1.3.tgz#dfa18a3a7e66e5d4a6665bf0a2392d143d15661a\"\n- integrity sha512-FKSx9l5Ekwm1Wt/ncoCwvsq8NAb1nylzMFlxrHixLYNBtO2eCQet+vwQag+74Nc/E9Lp3DKkBUCyBfz+zjtmAw==\n+lottie-ios@3.1.8:\n+ version \"3.1.8\"\n+ resolved \"https://registry.yarnpkg.com/lottie-ios/-/lottie-ios-3.1.8.tgz#2e9b1f4eae0dfc10bf4c0b3ab6b402c1d590d0fa\"\n+ integrity sha512-9bgiVn1n+zqWjDPTk4MVWXA+DgVa91payxV2jz8B2dsDFqWtjEqTZaaVo5IqNUExsaC5XkRbziExtTOtzd39tQ==\n-lottie-react-native@^3.2.1:\n- version \"3.2.1\"\n- resolved \"https://registry.yarnpkg.com/lottie-react-native/-/lottie-react-native-3.2.1.tgz#0b2b13b03a2cda9ece8474b9cf633d0fbe78d82b\"\n- integrity sha512-dmOySV+qgFrQszCY+7uOZR0XkgbP2FXgCWJZ2h39GqlxJZRHD2uCmXoT+WxaBGw83Gk/2KfIQ1MQMFL8UqC2bw==\n+lottie-react-native@^4.0.2:\n+ version \"4.0.2\"\n+ resolved \"https://registry.yarnpkg.com/lottie-react-native/-/lottie-react-native-4.0.2.tgz#d0b7a479995b4bfdf5402671e096f15b7ef2a7d8\"\n+ integrity sha512-8X5SV8X+es5dJwUGYcSyRIbHIPeWIcUH6PiRaReUEy+6s1d+NLBp3rj4+9I75F1ZN0nbFGNkrgypnGsXOAXBTw==\ndependencies:\ninvariant \"^2.2.2\"\n- lottie-ios \"^3.1.3\"\nprop-types \"^15.5.10\"\n- react-native-safe-modules \"^1.0.0\"\n+ react-native-safe-modules \"^1.0.3\"\nlottie-web@^5.7.8:\nversion \"5.7.8\"\n@@ -14880,10 +14879,10 @@ react-native-safe-area-view@^2.0.0:\ndependencies:\nhoist-non-react-statics \"^2.3.1\"\n-react-native-safe-modules@^1.0.0:\n- version \"1.0.0\"\n- resolved \"https://registry.yarnpkg.com/react-native-safe-modules/-/react-native-safe-modules-1.0.0.tgz#10a918adf97da920adb1e33e0c852b1e80123b65\"\n- integrity sha512-ShT8duWBT30W4OFcltZl+UvpPDikZFURvLDQqAsrvbyy6HzWPGJDCpdqM+6GqzPPs4DPEW31YfMNmdJcZ6zI2w==\n+react-native-safe-modules@^1.0.3:\n+ version \"1.0.3\"\n+ resolved \"https://registry.yarnpkg.com/react-native-safe-modules/-/react-native-safe-modules-1.0.3.tgz#f5f29bb9d09d17581193843d4173ad3054f74890\"\n+ integrity sha512-DUxti4Z+AgJ/ZsO5U7p3uSCUBko8JT8GvFlCeOXk9bMd+4qjpoDvMYpfbixXKgL88M+HwmU/KI1YFN6gsQZyBA==\ndependencies:\ndedent \"^0.6.0\"\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] lottie-react-native@4.0.2
Summary: This is necessary to fix the build with XCode 12.5.
Test Plan: In combination with D1087 and D1089, confirm that I can build iOS as (dev, release, archive) on (simulator, device
Reviewers: palys-swm
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1088 |
129,187 | 02.05.2021 21:35:42 | 25,200 | 148227c313f4e8a5938e3901ce312790fcba736d | [native] Fix sqlite_orm compilation on XCode 12.5
Summary: More details [here](https://github.com/fnc12/sqlite_orm/issues/716)
Test Plan:
1. In combination with D1087 and D1088, confirm that I can build iOS as (dev, release, archive) on (simulator, device
2. Confirm that Android still builds as well
Reviewers: karol-bisztyga
Subscribers: KatPo, palys-swm, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/CommonCpp/sqlite_orm/sqlite_orm.h",
"new_path": "native/CommonCpp/sqlite_orm/sqlite_orm.h",
"diff": "@@ -4922,7 +4922,7 @@ namespace sqlite_orm {\n#include <sqlite3.h>\n#include <type_traits> // std::enable_if_t, std::is_arithmetic, std::is_same, std::enable_if\n-#include <cstdlib> // atof, atoi, atoll\n+#include <stdlib.h> // atof, atoi, atoll\n#include <string> // std::string, std::wstring\n#ifndef SQLITE_ORM_OMITS_CODECVT\n#include <codecvt> // std::wstring_convert, std::codecvt_utf8_utf16\n@@ -6213,7 +6213,7 @@ namespace sqlite_orm {\n#include <cstddef> // std::nullptr_t\n#include <system_error> // std::system_error, std::error_code\n#include <sstream> // std::stringstream\n-#include <cstdlib> // std::atoi\n+#include <stdlib.h> // std::atoi\n#include <type_traits> // std::forward, std::enable_if, std::is_same, std::remove_reference, std::false_type, std::true_type\n#include <utility> // std::pair, std::make_pair\n#include <vector> // std::vector\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Fix sqlite_orm compilation on XCode 12.5
Summary: More details [here](https://github.com/fnc12/sqlite_orm/issues/716)
Test Plan:
1. In combination with D1087 and D1088, confirm that I can build iOS as (dev, release, archive) on (simulator, device
2. Confirm that Android still builds as well
Reviewers: karol-bisztyga
Subscribers: KatPo, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1089 |
129,187 | 03.05.2021 11:06:52 | 25,200 | 8a65c5d1585271e34ab75f9215bd943bfb6352b1 | [native] Show a cancel button while search is active
Summary: Modelled after Signal. Right now it's impossible to exit the search experience, so I hacked together a solution this morning.
Test Plan: Play around with it
Reviewers: palys-swm, KatPo
Subscribers: Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-thread-list.react.js",
"new_path": "native/chat/chat-thread-list.react.js",
"diff": "@@ -11,6 +11,7 @@ import {\nTouchableWithoutFeedback,\n} from 'react-native';\nimport { FloatingAction } from 'react-native-floating-action';\n+import Animated from 'react-native-reanimated';\nimport IonIcon from 'react-native-vector-icons/Ionicons';\nimport { createSelector } from 'reselect';\n@@ -33,6 +34,7 @@ import { threadTypes } from 'lib/types/thread-types';\nimport type { GlobalAccountUserInfo, UserInfo } from 'lib/types/user-types';\nimport { useServerCall } from 'lib/utils/action-utils';\n+import Button from '../components/button.react';\nimport Search from '../components/search.react';\nimport type { TabNavigationProp } from '../navigation/app-navigator.react';\nimport {\n@@ -48,6 +50,7 @@ import {\nindicatorStyleSelector,\nuseStyles,\n} from '../themes/colors';\n+import { animateTowards } from '../utils/animation-utils';\nimport ChatThreadListItem from './chat-thread-list-item.react';\nimport type {\nChatTopTabsNavigationProp,\n@@ -63,6 +66,10 @@ const floatingActions = [\n},\n];\n+/* eslint-disable import/no-named-as-default-member */\n+const { Value, interpolate } = Animated;\n+/* eslint-enable import/no-named-as-default-member */\n+\ntype Item =\n| ChatThreadItem\n| {| +type: 'search', +searchText: string |}\n@@ -113,6 +120,21 @@ class ChatThreadList extends React.PureComponent<Props, State> {\nflatList: ?FlatList<Item>;\nscrollPos = 0;\nclearNavigationBlurListener: ?() => mixed;\n+ searchCancelButtonOpen = new Value(0);\n+ searchCancelButtonProgress: Value;\n+ searchCancelButtonOffset: Value;\n+\n+ constructor(props: Props) {\n+ super(props);\n+ this.searchCancelButtonProgress = animateTowards(\n+ this.searchCancelButtonOpen,\n+ 100,\n+ );\n+ this.searchCancelButtonOffset = interpolate(\n+ this.searchCancelButtonProgress,\n+ { inputRange: [0, 1], outputRange: [0, 56] },\n+ );\n+ }\ncomponentDidMount() {\nthis.clearNavigationBlurListener = this.props.navigation.addListener(\n@@ -148,6 +170,19 @@ class ChatThreadList extends React.PureComponent<Props, State> {\n}\ncomponentDidUpdate(prevProps: Props, prevState: State) {\n+ const { searchStatus } = this.state;\n+ const prevSearchStatus = prevState.searchStatus;\n+\n+ const isActiveOrActivating =\n+ searchStatus === 'active' || searchStatus === 'activating';\n+ const wasActiveOrActivating =\n+ prevSearchStatus === 'active' || prevSearchStatus === 'activating';\n+ if (isActiveOrActivating && !wasActiveOrActivating) {\n+ this.searchCancelButtonOpen.setValue(1);\n+ } else if (!isActiveOrActivating && wasActiveOrActivating) {\n+ this.searchCancelButtonOpen.setValue(0);\n+ }\n+\nconst { flatList } = this;\nif (!flatList) {\nreturn;\n@@ -158,8 +193,6 @@ class ChatThreadList extends React.PureComponent<Props, State> {\nreturn;\n}\n- const { searchStatus } = this.state;\n- const prevSearchStatus = prevState.searchStatus;\nif (searchStatus === 'activating' && prevSearchStatus === 'inactive') {\nflatList.scrollToOffset({ offset: 0, animated: true });\n}\n@@ -197,8 +230,26 @@ class ChatThreadList extends React.PureComponent<Props, State> {\n};\nrenderSearch(additionalProps?: $Shape<React.ElementConfig<typeof Search>>) {\n+ const searchBoxStyle = [\n+ this.props.styles.searchBox,\n+ { marginRight: this.searchCancelButtonOffset },\n+ ];\n+ const buttonStyle = [\n+ this.props.styles.cancelSearchButtonText,\n+ { opacity: this.searchCancelButtonProgress },\n+ ];\nreturn (\n<View style={this.props.styles.searchContainer}>\n+ <Button\n+ onPress={this.onSearchBlur}\n+ disabled={this.state.searchStatus !== 'active'}\n+ style={this.props.styles.cancelSearchButton}\n+ >\n+ {/* eslint-disable react-native/no-raw-text */}\n+ <Animated.Text style={buttonStyle}>Cancel</Animated.Text>\n+ {/* eslint-enable react-native/no-raw-text */}\n+ </Button>\n+ <Animated.View style={searchBoxStyle}>\n<Search\nsearchText={this.state.searchText}\nonChangeText={this.onChangeSearchText}\n@@ -208,6 +259,7 @@ class ChatThreadList extends React.PureComponent<Props, State> {\nref={this.searchInputRef}\n{...additionalProps}\n/>\n+ </Animated.View>\n</View>\n);\n}\n@@ -511,12 +563,31 @@ const unboundStyles = {\n},\nsearchContainer: {\nbackgroundColor: 'listBackground',\n+ display: 'flex',\n+ justifyContent: 'center',\n+ flexDirection: 'row',\n+ },\n+ searchBox: {\n+ flex: 1,\n},\nsearch: {\nmarginBottom: 8,\nmarginHorizontal: 12,\nmarginTop: Platform.OS === 'android' ? 10 : 8,\n},\n+ cancelSearchButton: {\n+ position: 'absolute',\n+ right: 0,\n+ top: 0,\n+ bottom: 0,\n+ display: 'flex',\n+ justifyContent: 'center',\n+ },\n+ cancelSearchButtonText: {\n+ color: 'link',\n+ fontSize: 16,\n+ paddingHorizontal: 10,\n+ },\nflatList: {\nflex: 1,\nbackgroundColor: 'listBackground',\n"
},
{
"change_type": "MODIFY",
"old_path": "native/utils/animation-utils.js",
"new_path": "native/utils/animation-utils.js",
"diff": "@@ -19,6 +19,7 @@ const {\ngreaterThan,\nlessThan,\neq,\n+ neq,\nadd,\nsub,\nmultiply,\n@@ -204,6 +205,56 @@ function useReanimatedValueForBoolean(booleanValue: boolean): Value {\nreturn reanimatedValueRef.current;\n}\n+// Target can be either 0 or 1. Caller handles interpolating\n+function animateTowards(\n+ target: Value,\n+ fullAnimationLength: number, // in ms\n+): Value {\n+ const curValue = new Value(-1);\n+ const prevTarget = new Value(-1);\n+ const clock = new Clock();\n+\n+ const prevClockValue = new Value(0);\n+ const curDeltaClockValue = new Value(0);\n+ const deltaClockValue = [\n+ set(\n+ curDeltaClockValue,\n+ cond(eq(prevClockValue, 0), 0, sub(clock, prevClockValue)),\n+ ),\n+ set(prevClockValue, clock),\n+ curDeltaClockValue,\n+ ];\n+ const progressPerFrame = divide(deltaClockValue, fullAnimationLength);\n+\n+ return block([\n+ [\n+ cond(eq(curValue, -1), set(curValue, target)),\n+ cond(eq(prevTarget, -1), set(prevTarget, target)),\n+ ],\n+ cond(neq(target, prevTarget), [stopClock(clock), set(prevTarget, target)]),\n+ cond(neq(curValue, target), [\n+ cond(not(clockRunning(clock)), [\n+ set(prevClockValue, 0),\n+ startClock(clock),\n+ ]),\n+ set(\n+ curValue,\n+ cond(\n+ eq(target, 1),\n+ add(curValue, progressPerFrame),\n+ sub(curValue, progressPerFrame),\n+ ),\n+ ),\n+ ]),\n+ [\n+ cond(greaterThan(curValue, 1), set(curValue, 1)),\n+ cond(lessThan(curValue, 0), set(curValue, 0)),\n+ ],\n+ cond(eq(curValue, target), [stopClock(clock)]),\n+ curValue,\n+ ]);\n+}\n+\nexport {\nclamp,\ndividePastDistance,\n@@ -214,4 +265,5 @@ export {\nrunSpring,\nratchetAlongWithKeyboardHeight,\nuseReanimatedValueForBoolean,\n+ animateTowards,\n};\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Show a cancel button while search is active
Summary: Modelled after Signal. Right now it's impossible to exit the search experience, so I hacked together a solution this morning.
Test Plan: Play around with it
Reviewers: palys-swm, KatPo
Subscribers: Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1091 |
129,187 | 03.05.2021 16:26:54 | 25,200 | 55ed78c7e400f59192428b3b552afddbcd7a4207 | [native] codeVersion -> 82 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -143,8 +143,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 81\n- versionName \"0.0.81\"\n+ versionCode 82\n+ versionName \"0.0.82\"\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.debug.plist",
"new_path": "native/ios/SquadCal/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.81</string>\n+ <string>0.0.82</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>81</string>\n+ <string>82</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.release.plist",
"new_path": "native/ios/SquadCal/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.81</string>\n+ <string>0.0.82</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>81</string>\n+ <string>82</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux/persist.js",
"new_path": "native/redux/persist.js",
"diff": "@@ -228,7 +228,7 @@ const persistConfig = {\ntimeout: __DEV__ ? 0 : undefined,\n};\n-const codeVersion = 81;\n+const codeVersion = 82;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] codeVersion -> 82 |
129,187 | 03.05.2021 17:55:45 | 25,200 | df6c7489a4e1e0678de33bf5e33d286680ae1f2b | [native] Increase tap target surface for clear search button
Test Plan: Test it on Android
Reviewers: atul
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "native/components/search.react.js",
"new_path": "native/components/search.react.js",
"diff": "@@ -48,7 +48,11 @@ const Search = React.forwardRef<Props, typeof TextInput>(\nlet clearSearchInputIcon = null;\nif (searchText) {\nclearSearchInputIcon = (\n- <TouchableOpacity onPress={clearSearch} activeOpacity={0.5}>\n+ <TouchableOpacity\n+ onPress={clearSearch}\n+ activeOpacity={0.5}\n+ style={styles.clearSearchButton}\n+ >\n<Icon name=\"times-circle\" size={18} color={iconColor} />\n</TouchableOpacity>\n);\n@@ -102,8 +106,7 @@ const unboundStyles = {\nborderRadius: 6,\nflexDirection: 'row',\npaddingLeft: 14,\n- paddingRight: 12,\n- paddingVertical: 6,\n+ paddingRight: 7,\n},\ninactiveSearchText: {\ntransform: Platform.select({\n@@ -116,10 +119,13 @@ const unboundStyles = {\nflex: 1,\nfontSize: 16,\nmarginLeft: 8,\n- marginVertical: 0,\n+ marginVertical: 6,\npadding: 0,\nborderBottomColor: 'transparent',\n},\n+ clearSearchButton: {\n+ padding: 5,\n+ },\n};\nexport default React.memo<Props>(Search);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Increase tap target surface for clear search button
Test Plan: Test it on Android
Reviewers: atul
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1097 |
129,187 | 03.05.2021 17:57:35 | 25,200 | fb18fe18029244b5cd72f0caf1dcad0f795eb78a | [native] codeVersion -> 83 | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/build.gradle",
"new_path": "native/android/app/build.gradle",
"diff": "@@ -143,8 +143,8 @@ android {\napplicationId \"org.squadcal\"\nminSdkVersion rootProject.ext.minSdkVersion\ntargetSdkVersion rootProject.ext.targetSdkVersion\n- versionCode 82\n- versionName \"0.0.82\"\n+ versionCode 83\n+ versionName \"0.0.83\"\nmissingDimensionStrategy 'react-native-camera', 'general'\nmultiDexEnabled true\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.debug.plist",
"new_path": "native/ios/SquadCal/Info.debug.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.82</string>\n+ <string>0.0.83</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>82</string>\n+ <string>83</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/ios/SquadCal/Info.release.plist",
"new_path": "native/ios/SquadCal/Info.release.plist",
"diff": "<key>CFBundlePackageType</key>\n<string>APPL</string>\n<key>CFBundleShortVersionString</key>\n- <string>0.0.82</string>\n+ <string>0.0.83</string>\n<key>CFBundleSignature</key>\n<string>????</string>\n<key>CFBundleVersion</key>\n- <string>82</string>\n+ <string>83</string>\n<key>LSApplicationQueriesSchemes</key>\n<array>\n<string>org-appextension-feature-password-management</string>\n"
},
{
"change_type": "MODIFY",
"old_path": "native/redux/persist.js",
"new_path": "native/redux/persist.js",
"diff": "@@ -228,7 +228,7 @@ const persistConfig = {\ntimeout: __DEV__ ? 0 : undefined,\n};\n-const codeVersion = 82;\n+const codeVersion = 83;\n// This local exists to avoid a circular dependency where redux-setup needs to\n// import all the navigation and screen stuff, but some of those screens want to\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] codeVersion -> 83 |
129,187 | 04.05.2021 16:12:23 | 25,200 | 56bbdb4a2f356df0b30bdf58a93188303ae1bb42 | [landing] Clean up design
Test Plan: Test it using Chrome
Reviewers: atul
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.css",
"new_path": "landing/landing.css",
"diff": "@@ -3,6 +3,8 @@ html {\nbackground-attachment: fixed;\nfont-family: 'IBM Plex Sans', sans-serif;\ncolor: white;\n+ word-break: break-word;\n+ max-width: 1920px;\n}\nh1,\n@@ -11,10 +13,13 @@ h2 {\nfont-weight: 600;\n}\n+div.title_container {\n+ grid-area: title_container;\n+}\n+\nh1.title {\nfont-family: 'IBM Plex Sans', sans-serif;\nfont-size: 24px;\n- padding-left: 60px;\n}\nh1 {\n@@ -36,21 +41,91 @@ p {\ndiv.grid {\ndisplay: grid;\npadding-top: 20px;\n- padding-left: 60px;\n- padding-right: 60px;\n+ padding-left: 80px;\n+ padding-right: 80px;\npadding-bottom: 40px;\n- row-gap: 14em;\n- column-gap: 4em;\n- grid-template-rows: 1fr 1fr 1fr 1/6fr;\n+ column-gap: 6em;\ngrid-template-columns: 1fr 1fr;\ngrid-template-areas:\n+ 'title_container title_container'\n'hero_copy hero_image'\n- 'server_copy server_image'\n+ 'server_image server_copy'\n+ 'keyserver_company keyserver_company'\n'keyserver_copy read_the_docs'\n'footer_logo subscribe_updates';\n}\n+div.grid > div + .starting_section {\n+ padding-top: 80px;\n+}\n+\n+.section {\n+ padding-top: 80px;\n+}\n+\n+div.hero_copy {\n+ grid-area: hero_copy;\n+ align-self: center;\n+}\n+\n+div.hero_image {\n+ grid-area: hero_image;\n+ object-fit: scale-down;\n+ align-self: center;\n+}\n+\n+div.server_copy {\n+ grid-area: server_copy;\n+ align-self: center;\n+}\n+\n+div.server_image {\n+ grid-area: server_image;\n+ object-fit: scale-down;\n+ align-self: center;\n+}\n+\n+div.keyserver_company {\n+ grid-area: keyserver_company;\n+ align-self: center;\n+ text-align: center;\n+ padding-top: 80px;\n+}\n+\n+div.keyserver_copy {\n+ grid-area: keyserver_copy;\n+ align-self: center;\n+ padding-bottom: 40px;\n+}\n+\n+div.read_the_docs {\n+ grid-area: read_the_docs;\n+ align-self: center;\n+ padding-bottom: 40px;\n+}\n+\n+div.footer_logo {\n+ font-family: 'IBM Plex Sans', sans-serif;\n+ font-size: 24px;\n+ grid-area: footer_logo;\n+ align-self: center;\n+ font-weight: 600;\n+}\n+\n+div.subscribe_updates {\n+ grid-area: subscribe_updates;\n+}\n+\n+div.particles {\n+ z-index: -1;\n+}\n+\n@media (max-width: 1499px) {\n+ div.grid {\n+ padding-left: 60px;\n+ padding-right: 60px;\n+ }\n+\nh1 {\nfont-size: 42px;\n}\n@@ -67,16 +142,17 @@ div.grid {\n@media (max-width: 1099px) {\ndiv.grid {\ndisplay: grid;\n- padding-left: 60px;\n- padding-right: 60px;\n- row-gap: 2em;\n+ padding-left: 3%;\n+ padding-right: 3%;\ngrid-template-columns: minmax(auto, 540px);\njustify-content: center;\ngrid-template-areas:\n+ 'title_container'\n'hero_image'\n'hero_copy'\n'server_image'\n'server_copy'\n+ 'keyserver_company'\n'keyserver_copy'\n'read_the_docs'\n'subscribe_updates'\n@@ -84,68 +160,36 @@ div.grid {\n}\nh1 {\n- font-size: 32px;\n+ font-size: 28px;\n}\nh2 {\n- font-size: 26px;\n+ font-size: 24px;\n}\np {\n- font-size: 18px;\n+ font-size: 16px;\n}\n- div.server_image {\n- grid-area: server_image;\n- object-fit: scale-down;\n- align-self: center;\n- }\n-}\n-\n-div.hero_copy {\n- grid-area: hero_copy;\n- align-self: center;\n-}\n-\n-div.hero_image {\n- grid-area: hero_image;\n- object-fit: scale-down;\n- align-self: center;\n+ .section {\n+ padding-top: 20px;\n}\n-div.server_copy {\n- grid-area: server_copy;\n- align-self: center;\n+ div.keyserver_company {\n+ text-align: left;\n+ padding-top: 60px;\n}\n-div.server_image {\n- grid-area: server_image;\n- object-fit: scale-down;\n- align-self: center;\n+ .keyserver_company > h1 {\n+ font-size: 24px;\n}\ndiv.keyserver_copy {\n- grid-area: keyserver_copy;\n- align-self: center;\n+ padding-bottom: 0;\n}\ndiv.read_the_docs {\n- grid-area: read_the_docs;\n- align-self: flex-end;\n-}\n-\n-div.footer_logo {\n- font-family: 'IBM Plex Sans', sans-serif;\n- font-size: 24px;\n- grid-area: footer_logo;\n- align-self: center;\n- font-weight: 600;\n-}\n-\n-div.subscribe_updates {\n- grid-area: subscribe_updates;\n+ padding-top: 20px;\n+ padding-bottom: 0;\n}\n-\n-div.particles {\n- z-index: -1;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "@@ -70,9 +70,11 @@ function Landing(): React.Node {\nreturn (\n<div>\n<StarBackground className={css.particles} />\n- <h1 className={css.title}>Comm</h1>\n<div className={css.grid}>\n- <div className={css.hero_image}>\n+ <div className={css.title_container}>\n+ <h1 className={css.title}>Comm</h1>\n+ </div>\n+ <div className={`${css.hero_image} ${css.starting_section}`}>\n<lottie-player\nid=\"eye-illustration\"\nref={setEyeNode}\n@@ -81,7 +83,7 @@ function Landing(): React.Node {\nspeed={1}\n/>\n</div>\n- <div className={css.hero_copy}>\n+ <div className={`${css.hero_copy} ${css.section}`}>\n<h1>\nReclaim your\n<span className={css.purple}> digital identity.</span>\n@@ -96,7 +98,7 @@ function Landing(): React.Node {\n</p>\n</div>\n- <div className={css.server_image}>\n+ <div className={`${css.server_image} ${css.starting_section}`}>\n<lottie-player\nid=\"cloud-illustration\"\nref={setCloudNode}\n@@ -105,7 +107,7 @@ function Landing(): React.Node {\nspeed={1}\n/>\n</div>\n- <div className={css.server_copy}>\n+ <div className={`${css.server_copy} ${css.section}`}>\n<h2>Apps need servers.</h2>\n<p>\nSophisticated applications rely on servers to do things that your\n@@ -118,8 +120,13 @@ function Landing(): React.Node {\n</p>\n</div>\n+ <div className={css.keyserver_company}>\n+ <h1>\n+ Comm is the <span className={css.purple}>keyserver</span> company.\n+ </h1>\n+ </div>\n+\n<div className={css.keyserver_copy}>\n- <h2>Comm is the keyserver company.</h2>\n<p>In the future, people have their own servers.</p>\n<p>\nYour keyserver is the home of your digital identity. It owns your\n@@ -132,8 +139,8 @@ function Landing(): React.Node {\n<ReadDocsButton />\n</div>\n- <div className={css.footer_logo}>Comm</div>\n- <div className={css.subscribe_updates}>\n+ <div className={`${css.footer_logo} ${css.starting_section}`}>Comm</div>\n+ <div className={`${css.subscribe_updates} ${css.starting_section}`}>\n<SubscriptionForm />\n</div>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/read-docs-btn.css",
"new_path": "landing/read-docs-btn.css",
"diff": "+.buttonContainer {\n+ text-decoration: none;\n+}\n+\n.button {\n- position: relative;\n- height: 160px;\n+ display: flex;\n+ justify-content: space-between;\nwidth: 100%;\nborder: 2px solid white;\ncolor: white;\nbackground: transparent;\n- padding: 28px;\ncursor: pointer;\ntext-align: left;\n- padding-top: 100px;\nborder-radius: 8px;\nfont-family: 'IBM Plex Sans', sans-serif;\nfont-size: 24px;\n+ padding: 30px;\n+ height: 160px;\n}\n-@media (max-width: 1099px) {\n- .button {\n- font-size: 18px;\n- }\n+.buttonText {\n+ align-self: flex-end;\n}\n.button:hover {\n}\n.cornerIcon {\n- position: absolute;\n- top: 20px;\n- right: 20px;\n+ align-self: flex-start;\n+ padding-left: 5px;\n+}\n+\n+@media (max-width: 1099px) {\n+ .button {\n+ font-size: 18px;\n+ padding: 15px 20px;\n+ height: auto;\n+ }\n+ .buttonText {\n+ align-self: center;\n+ }\n+ .cornerIcon {\n+ align-self: center;\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/read-docs-btn.react.js",
"new_path": "landing/read-docs-btn.react.js",
"diff": "@@ -6,12 +6,13 @@ import css from './read-docs-btn.css';\nfunction ReadDocsButton(): React.Node {\nreturn (\n- <a href=\"https://www.notion.so/Comm-4ec7bbc1398442ce9add1d7953a6c584\">\n+ <a\n+ href=\"https://www.notion.so/Comm-4ec7bbc1398442ce9add1d7953a6c584\"\n+ className={css.buttonContainer}\n+ >\n<button className={css.button}>\n- Read the documentation\n- <span className={css.cornerIcon}>\n- <img src=\"images/corner_arrow.svg\"></img>\n- </span>\n+ <span className={css.buttonText}>Read the documentation</span>\n+ <img src=\"images/corner_arrow.svg\" className={css.cornerIcon} />\n</button>\n</a>\n);\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Clean up design
Test Plan: Test it using Chrome
Reviewers: atul
Reviewed By: atul
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1104 |
129,187 | 04.05.2021 19:54:13 | 25,200 | 17d0750d92c585933b65713229da34e981eeba63 | [landing] Final fixes (hopefully?)
Test Plan: Load it
Reviewers: atul
Subscribers: KatPo, palys-swm, Adrian | [
{
"change_type": "MODIFY",
"old_path": "landing/landing.css",
"new_path": "landing/landing.css",
"diff": "@@ -13,13 +13,10 @@ h2 {\nfont-weight: 600;\n}\n-div.title_container {\n- grid-area: title_container;\n-}\n-\nh1.title {\nfont-family: 'IBM Plex Sans', sans-serif;\nfont-size: 24px;\n+ grid-area: title_container;\n}\nh1 {\n@@ -36,6 +33,7 @@ h2 {\np {\nfont-size: 24px;\n+ line-height: 1.6em;\n}\ndiv.grid {\n"
},
{
"change_type": "MODIFY",
"old_path": "landing/landing.react.js",
"new_path": "landing/landing.react.js",
"diff": "@@ -71,9 +71,7 @@ function Landing(): React.Node {\n<div>\n<StarBackground className={css.particles} />\n<div className={css.grid}>\n- <div className={css.title_container}>\n<h1 className={css.title}>Comm</h1>\n- </div>\n<div className={`${css.hero_image} ${css.starting_section}`}>\n<lottie-player\nid=\"eye-illustration\"\n@@ -131,7 +129,7 @@ function Landing(): React.Node {\n<p>\nYour keyserver is the home of your digital identity. It owns your\nprivate keys and your personal data. It's your password\n- manager, your crypto wallet, your digital surrogate, and your second\n+ manager, your crypto bank, your digital surrogate, and your second\nbrain.\n</p>\n</div>\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [landing] Final fixes (hopefully?)
Test Plan: Load it
Reviewers: atul
Subscribers: KatPo, palys-swm, Adrian
Differential Revision: https://phabricator.ashoat.com/D1106 |
129,190 | 07.05.2021 10:09:54 | -7,200 | 74a06822120d5537892c036feb2880601b9478a0 | [jsi] Add formatted c++ code
Summary: This is the code that's formatted using changes from D1047, pushed as a separate diff so the new style can be clearly seen.
Test Plan: None, please just see those files
Reviewers: palys-swm, ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/cpp/jniHelpers.h",
"new_path": "native/android/app/src/cpp/jniHelpers.h",
"diff": "@@ -7,18 +7,15 @@ namespace comm {\nnamespace jni = facebook::jni;\n-struct HashMap : jni::JavaClass<\n- HashMap,\n- jni::JMap<jni::JString, jni::JObject>\n-> {\n- static constexpr auto kJavaDescriptor =\n- \"Ljava/util/HashMap;\";\n+struct HashMap\n+ : jni::JavaClass<HashMap, jni::JMap<jni::JString, jni::JObject>> {\n+ static constexpr auto kJavaDescriptor = \"Ljava/util/HashMap;\";\njni::local_ref<jni::JObject> get(const std::string &key) {\n- static auto method = getClass()->getMethod<\n- jni::local_ref<jni::JObject>(jni::local_ref<jni::JObject>)\n- >(\"get\");\n- return method(self(), jni::make_jstring(key));;\n+ static auto method = getClass()\n+ ->getMethod<jni::local_ref<jni::JObject>(\n+ jni::local_ref<jni::JObject>)>(\"get\");\n+ return method(self(), jni::make_jstring(key));\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/android/app/src/cpp/jsiInstaller.cpp",
"new_path": "native/android/app/src/cpp/jsiInstaller.cpp",
"diff": "-#include <jsi/jsi.h>\n-#include <fbjni/fbjni.h>\n-#include <CallInvokerHolder.h>\n#include \"CommCoreModule.h\"\n#include \"SQLiteManager.h\"\n#include \"jniHelpers.h\"\n+#include <CallInvokerHolder.h>\n+#include <fbjni/fbjni.h>\n+#include <jsi/jsi.h>\nnamespace jni = facebook::jni;\nnamespace jsi = facebook::jsi;\nnamespace react = facebook::react;\n-class CommHybrid : public jni::HybridClass<CommHybrid>\n-{\n+class CommHybrid : public jni::HybridClass<CommHybrid> {\npublic:\n- static auto constexpr kJavaDescriptor =\n- \"Lorg/squadcal/fbjni/CommHybrid;\";\n+ static auto constexpr kJavaDescriptor = \"Lorg/squadcal/fbjni/CommHybrid;\";\nstatic void initHybrid(\njni::alias_ref<jhybridobject> jThis,\njlong jsContext,\njni::alias_ref<react::CallInvokerHolder::javaobject> jsCallInvokerHolder,\n- comm::HashMap additionalParameters\n- ) {\n+ comm::HashMap additionalParameters) {\njsi::Runtime *rt = (jsi::Runtime *)jsContext;\nauto jsCallInvoker = jsCallInvokerHolder->cthis()->getCallInvoker();\nstd::shared_ptr<comm::CommCoreModule> nativeModule =\n@@ -29,8 +26,7 @@ public:\nrt->global().setProperty(\n*rt,\njsi::PropNameID::forAscii(*rt, \"CommCoreModule\"),\n- jsi::Object::createFromHostObject(*rt, nativeModule)\n- );\n+ jsi::Object::createFromHostObject(*rt, nativeModule));\njni::local_ref<jni::JObject> sqliteFilePathObj =\nadditionalParameters.get(\"sqliteFilePath\");\n@@ -48,7 +44,5 @@ private:\n};\nJNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *) {\n- return jni::initialize(vm, [] {\n- CommHybrid::registerNatives();\n- });\n+ return jni::initialize(vm, [] { CommHybrid::registerNatives(); });\n}\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [jsi] Add formatted c++ code
Summary: This is the code that's formatted using changes from D1047, pushed as a separate diff so the new style can be clearly seen.
Test Plan: None, please just see those files
Reviewers: palys-swm, ashoat
Reviewed By: palys-swm, ashoat
Subscribers: ashoat, KatPo, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1048 |
129,191 | 07.05.2021 15:18:32 | -7,200 | 9bebd6bbb4dcea5e9d07fb25f283a141379ad819 | [lib] Create a constant holding local id prefix
Summary: We use `local` in a lot of places, so it makes sense to store it in a constant
Test Plan: Flow, test basic functionality
Reviewers: ashoat
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "lib/actions/entry-actions.js",
"new_path": "lib/actions/entry-actions.js",
"diff": "// @flow\n+import { localIDPrefix } from '../shared/message-utils';\nimport type {\nRawEntryInfo,\nCalendarQuery,\n@@ -60,7 +61,7 @@ function createLocalEntry(\n): RawEntryInfo {\nconst date = dateFromString(dateString);\nconst newEntryInfo: RawEntryInfo = {\n- localID: `local${localID}`,\n+ localID: `${localIDPrefix}${localID}`,\nthreadID,\ntext: '',\nyear: date.getFullYear(),\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/shared/message-utils.js",
"new_path": "lib/shared/message-utils.js",
"diff": "@@ -33,6 +33,8 @@ import { codeBlockRegex } from './markdown';\nimport { messageSpecs } from './messages/message-specs';\nimport { stringForUser } from './user-utils';\n+const localIDPrefix = 'local';\n+\n// Prefers localID\nfunction messageKey(messageInfo: MessageInfo | RawMessageInfo): string {\nif (messageInfo.localID) {\n@@ -349,7 +351,7 @@ function getMostRecentNonLocalMessageID(\nmessageStore: MessageStore,\n): ?string {\nconst thread = messageStore.threads[threadID];\n- return thread?.messageIDs.find((id) => !id.startsWith('local'));\n+ return thread?.messageIDs.find((id) => !id.startsWith(localIDPrefix));\n}\nexport type GetMessageTitleViewerContext =\n@@ -379,6 +381,7 @@ function removeCreatorAsViewer<Info: MessageInfo>(messageInfo: Info): Info {\n}\nexport {\n+ localIDPrefix,\nmessageKey,\nmessageID,\nrobotextForMessageInfo,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-input-bar.react.js",
"new_path": "native/chat/chat-input-bar.react.js",
"diff": "@@ -21,7 +21,7 @@ import { useDispatch } from 'react-redux';\nimport { joinThreadActionTypes, joinThread } from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n-import { trimMessage } from 'lib/shared/message-utils';\n+import { localIDPrefix, trimMessage } from 'lib/shared/message-utils';\nimport {\nthreadHasPermission,\nviewerIsMember,\n@@ -580,7 +580,7 @@ class ChatInputBar extends React.PureComponent<Props, State> {\nreturn;\n}\n- const localID = `local${this.props.nextLocalID}`;\n+ const localID = `${localIDPrefix}${this.props.nextLocalID}`;\nconst creatorID = this.props.viewerID;\ninvariant(creatorID, 'should have viewer ID in order to send a message');\ninvariant(\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-list.react.js",
"new_path": "native/chat/chat-list.react.js",
"diff": "@@ -17,7 +17,7 @@ import type {\n} from 'react-native/Libraries/Lists/FlatList';\nimport type { ChatMessageItem } from 'lib/selectors/chat-selectors';\n-import { messageKey } from 'lib/shared/message-utils';\n+import { localIDPrefix, messageKey } from 'lib/shared/message-utils';\nimport {\ntype KeyboardState,\n@@ -161,7 +161,7 @@ class ChatList extends React.PureComponent<Props, State> {\nbreak;\n}\n- if (curItemKey.startsWith('local')) {\n+ if (curItemKey.startsWith(localIDPrefix)) {\nnewLocalMessage = true;\n} else if (\ncurItem.itemType === 'message' &&\n"
},
{
"change_type": "MODIFY",
"old_path": "native/input/input-state-container.react.js",
"new_path": "native/input/input-state-container.react.js",
"diff": "@@ -29,7 +29,10 @@ import {\ncreateLoadingStatusSelector,\ncombineLoadingStatuses,\n} from 'lib/selectors/loading-selectors';\n-import { createMediaMessageInfo } from 'lib/shared/message-utils';\n+import {\n+ createMediaMessageInfo,\n+ localIDPrefix,\n+} from 'lib/shared/message-utils';\nimport {\ncreateRealThreadFromPendingThread,\nthreadIsPending,\n@@ -431,7 +434,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nselections: $ReadOnlyArray<NativeMediaSelection>,\n) => {\nthis.sendCallbacks.forEach((callback) => callback());\n- const localMessageID = `local${this.props.nextLocalID}`;\n+ const localMessageID = `${localIDPrefix}${this.props.nextLocalID}`;\nconst uploadFileInputs = [],\nmedia = [];\n"
},
{
"change_type": "MODIFY",
"old_path": "server/src/updaters/activity-updaters.js",
"new_path": "server/src/updaters/activity-updaters.js",
"diff": "@@ -4,6 +4,7 @@ import invariant from 'invariant';\nimport _difference from 'lodash/fp/difference';\nimport _max from 'lodash/fp/max';\n+import { localIDPrefix } from 'lib/shared/message-utils';\nimport type {\nUpdateActivityResult,\nUpdateActivityRequest,\n@@ -109,7 +110,8 @@ async function activityUpdater(\nfocusUpdates\n.filter(\n(update) =>\n- update.latestMessage && !update.latestMessage.startsWith('local'),\n+ update.latestMessage &&\n+ !update.latestMessage.startsWith(localIDPrefix),\n)\n.map((update) => parseInt(update.latestMessage)),\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "web/chat/chat-input-bar.react.js",
"new_path": "web/chat/chat-input-bar.react.js",
"diff": "@@ -9,7 +9,7 @@ import * as React from 'react';\nimport { joinThreadActionTypes, joinThread } from 'lib/actions/thread-actions';\nimport { createLoadingStatusSelector } from 'lib/selectors/loading-selectors';\n-import { trimMessage } from 'lib/shared/message-utils';\n+import { localIDPrefix, trimMessage } from 'lib/shared/message-utils';\nimport {\nthreadHasPermission,\nviewerIsMember,\n@@ -352,7 +352,7 @@ class ChatInputBar extends React.PureComponent<Props> {\ndispatchTextMessageAction(text: string, nextLocalID: number) {\nthis.props.inputState.setDraft('');\n- const localID = `local${nextLocalID}`;\n+ const localID = `${localIDPrefix}${nextLocalID}`;\nconst creatorID = this.props.viewerID;\ninvariant(creatorID, 'should have viewer ID in order to send a message');\n"
},
{
"change_type": "MODIFY",
"old_path": "web/input/input-state-container.react.js",
"new_path": "web/input/input-state-container.react.js",
"diff": "@@ -30,7 +30,10 @@ import {\n} from 'lib/actions/upload-actions';\nimport { getNextLocalUploadID } from 'lib/media/media-utils';\nimport { pendingToRealizedThreadIDsSelector } from 'lib/selectors/thread-selectors';\n-import { createMediaMessageInfo } from 'lib/shared/message-utils';\n+import {\n+ createMediaMessageInfo,\n+ localIDPrefix,\n+} from 'lib/shared/message-utils';\nimport {\ncreateRealThreadFromPendingThread,\nthreadIsPending,\n@@ -165,7 +168,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nfor (const localUploadID in pendingUploads) {\nconst upload = pendingUploads[localUploadID];\nconst { messageID, serverID, failed } = upload;\n- if (!messageID || !messageID.startsWith('local')) {\n+ if (!messageID || !messageID.startsWith(localIDPrefix)) {\ncontinue;\n}\nif (!serverID || failed) {\n@@ -211,7 +214,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\nconst { messageID } = upload;\nif (\n!messageID ||\n- !messageID.startsWith('local') ||\n+ !messageID.startsWith(localIDPrefix) ||\npreviouslyAssignedMessageIDs.has(messageID)\n) {\ncontinue;\n@@ -798,7 +801,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n`missing while assigning URI`,\n);\nconst { messageID } = currentUpload;\n- if (messageID && !messageID.startsWith('local')) {\n+ if (messageID && !messageID.startsWith(localIDPrefix)) {\nconst newPendingUploads = _omit([localID])(uploads);\nreturn {\npendingUploads: {\n@@ -1024,7 +1027,7 @@ class InputStateContainer extends React.PureComponent<Props, State> {\n// Creates a MultimediaMessage from the unassigned pending uploads,\n// if there are any\ncreateMultimediaMessage(localID: number, threadInfo: ThreadInfo) {\n- const localMessageID = `local${localID}`;\n+ const localMessageID = `${localIDPrefix}${localID}`;\nthis.startThreadCreation(threadInfo);\nthis.setState((prevState) => {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Create a constant holding local id prefix
Summary: We use `local` in a lot of places, so it makes sense to store it in a constant
Test Plan: Flow, test basic functionality
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1119 |
129,187 | 10.05.2021 01:19:20 | 14,400 | b532a8e65e8c8ba7f03cffcdad34501b8eab5791 | [native] Move CommCoreModule shim to a separate file
Summary: I figured this would be better in a separate file
Test Plan: Flow
Reviewers: karol-bisztyga, palys-swm
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "native/data/core-module-shim.js",
"diff": "+// @flow\n+\n+if (!global.CommCoreModule) {\n+ global.CommCoreModule = {\n+ getDraft: () => '',\n+ updateDraft: () => {},\n+ };\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "native/root.react.js",
"new_path": "native/root.react.js",
"diff": "@@ -41,6 +41,7 @@ import Socket from './socket.react';\nimport { DarkTheme, LightTheme } from './themes/navigation';\nimport ThemeHandler from './themes/theme-handler.react';\nimport './themes/fonts';\n+import './data/core-module-shim';\nLogBox.ignoreLogs([\n// react-native-reanimated\n@@ -52,13 +53,6 @@ if (Platform.OS === 'android') {\nUIManager.setLayoutAnimationEnabledExperimental(true);\n}\n-if (!global.CommCoreModule) {\n- global.CommCoreModule = {\n- getDraft: () => '',\n- updateDraft: () => {},\n- };\n-}\n-\nconst navInitAction = Object.freeze({ type: 'NAV/@@INIT' });\nconst navUnknownAction = Object.freeze({ type: 'NAV/@@UNKNOWN' });\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Move CommCoreModule shim to a separate file
Summary: I figured this would be better in a separate file
Test Plan: Flow
Reviewers: karol-bisztyga, palys-swm
Reviewed By: karol-bisztyga, palys-swm
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1114 |
129,191 | 11.05.2021 12:54:44 | -7,200 | fca5b21b9a1e03ca43898c71b012ca392662c23f | [lib] Delete useRealThreadCreator hook
Summary: Here and in D1139 the last usages were removed so we can delete the hook completely
Test Plan: Flow, tested with other diffs
Reviewers: ashoat
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "lib/shared/thread-utils.js",
"new_path": "lib/shared/thread-utils.js",
"diff": "@@ -10,7 +10,7 @@ import {\nfetchMostRecentMessagesActionTypes,\nfetchMostRecentMessages,\n} from '../actions/message-actions';\n-import { newThread, newThreadActionTypes } from '../actions/thread-actions';\n+import { newThreadActionTypes } from '../actions/thread-actions';\nimport {\npermissionLookup,\ngetAllThreadPermissions,\n@@ -44,11 +44,7 @@ import {\nthreadTypes,\nthreadPermissions,\n} from '../types/thread-types';\n-import type {\n- NewThreadRequest,\n- NewThreadResult,\n- OptimisticThreadInfo,\n-} from '../types/thread-types';\n+import type { NewThreadRequest, NewThreadResult } from '../types/thread-types';\nimport { type UpdateInfo, updateTypes } from '../types/update-types';\nimport type {\nGlobalAccountUserInfo,\n@@ -455,61 +451,6 @@ async function createRealThreadFromPendingThread({\n}\n}\n-function useRealThreadCreator(\n- thread: ?OptimisticThreadInfo,\n- handleError?: () => mixed,\n-) {\n- const creationResultRef = React.useRef<?{|\n- +pendingThreadID: string,\n- +serverThreadID: ?string,\n- |}>();\n-\n- const threadInfo = thread?.threadInfo;\n- const threadID = threadInfo?.id;\n- const creationResult = creationResultRef.current;\n- const serverThreadID = React.useMemo(() => {\n- if (threadID && !threadIsPending(threadID)) {\n- return threadID;\n- } else if (creationResult && creationResult.pendingThreadID === threadID) {\n- return creationResult.serverThreadID;\n- }\n- return null;\n- }, [threadID, creationResult]);\n-\n- const viewerID = useSelector((state) => state.currentUserInfo?.id);\n- const sourceMessageID = thread?.sourceMessageID;\n- const dispatchActionPromise = useDispatchActionPromise();\n- const callNewThread = useServerCall(newThread);\n- return React.useCallback(async () => {\n- if (serverThreadID) {\n- return serverThreadID;\n- } else if (!threadInfo) {\n- return null;\n- }\n- const newThreadID = await createRealThreadFromPendingThread({\n- threadInfo,\n- dispatchActionPromise,\n- createNewThread: callNewThread,\n- sourceMessageID,\n- viewerID,\n- handleError,\n- });\n- creationResultRef.current = {\n- pendingThreadID: threadInfo.id,\n- serverThreadID: newThreadID,\n- };\n- return newThreadID;\n- }, [\n- callNewThread,\n- dispatchActionPromise,\n- handleError,\n- serverThreadID,\n- sourceMessageID,\n- threadInfo,\n- viewerID,\n- ]);\n-}\n-\ntype RawThreadInfoOptions = {|\n+includeVisibilityRules?: ?boolean,\n+filterMemberList?: ?boolean,\n@@ -1079,7 +1020,6 @@ export {\ncreatePendingSidebar,\npendingThreadType,\ncreateRealThreadFromPendingThread,\n- useRealThreadCreator,\ngetCurrentUser,\nthreadFrozenDueToBlock,\nthreadFrozenDueToViewerBlock,\n"
},
{
"change_type": "MODIFY",
"old_path": "native/keyboard/keyboard-input-host.react.js",
"new_path": "native/keyboard/keyboard-input-host.react.js",
"diff": "import invariant from 'invariant';\nimport * as React from 'react';\n-import { Alert, TextInput } from 'react-native';\n+import { TextInput } from 'react-native';\nimport { KeyboardAccessoryView } from 'react-native-keyboard-input';\n-import { useRealThreadCreator } from 'lib/shared/thread-utils';\nimport type { MediaLibrarySelection } from 'lib/types/media-types';\nimport { type InputState, InputStateContext } from '../input/input-state';\n@@ -27,7 +26,6 @@ type Props = {|\n+keyboardState: KeyboardState,\n// withInputState\n+inputState: ?InputState,\n- +getServerThreadID: () => Promise<?string>,\n|};\nclass KeyboardInputHost extends React.PureComponent<Props> {\ncomponentDidUpdate(prevProps: Props) {\n@@ -92,25 +90,16 @@ const unboundStyles = {\n},\n};\n-const showErrorAlert = () =>\n- Alert.alert('Unknown error', 'Uhh... try again?', [{ text: 'OK' }], {\n- cancelable: false,\n- });\n-\nexport default React.memo<BaseProps>(function ConnectedKeyboardInputHost(\nprops: BaseProps,\n) {\nconst inputState = React.useContext(InputStateContext);\nconst keyboardState = React.useContext(KeyboardContext);\n+ invariant(keyboardState, 'keyboardState should be initialized');\nconst navContext = React.useContext(NavContext);\nconst styles = useStyles(unboundStyles);\nconst activeMessageList = activeMessageListSelector(navContext);\n- invariant(keyboardState, 'keyboardState should be initialized');\n- const getServerThreadID = useRealThreadCreator(\n- keyboardState.getMediaGalleryThread(),\n- showErrorAlert,\n- );\nreturn (\n<KeyboardInputHost\n{...props}\n@@ -118,7 +107,6 @@ export default React.memo<BaseProps>(function ConnectedKeyboardInputHost(\nactiveMessageList={activeMessageList}\nkeyboardState={keyboardState}\ninputState={inputState}\n- getServerThreadID={getServerThreadID}\n/>\n);\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/camera-modal.react.js",
"new_path": "native/media/camera-modal.react.js",
"diff": "@@ -11,7 +11,6 @@ import {\nImage,\nAnimated,\nEasing,\n- Alert,\n} from 'react-native';\nimport { RNCamera } from 'react-native-camera';\nimport filesystem from 'react-native-fs';\n@@ -30,7 +29,6 @@ import { useDispatch } from 'react-redux';\nimport { pathFromURI, filenameFromPathOrURI } from 'lib/media/file-utils';\nimport { useIsAppForegrounded } from 'lib/shared/lifecycle-utils';\n-import { useRealThreadCreator } from 'lib/shared/thread-utils';\nimport type { PhotoCapture } from 'lib/types/media-types';\nimport type { Dispatch } from 'lib/types/redux-types';\nimport type { OptimisticThreadInfo } from 'lib/types/thread-types';\n@@ -240,7 +238,6 @@ type Props = {|\n+foreground: boolean,\n// Redux dispatch functions\n+dispatch: Dispatch,\n- +getServerThreadID: () => Promise<?string>,\n// withInputState\n+inputState: ?InputState,\n// withOverlayContext\n@@ -1184,11 +1181,6 @@ const styles = StyleSheet.create({\n},\n});\n-const showErrorAlert = () =>\n- Alert.alert('Unknown error', 'Uhh... try again?', [{ text: 'OK' }], {\n- cancelable: false,\n- });\n-\nexport default React.memo<BaseProps>(function ConnectedCameraModal(\nprops: BaseProps,\n) {\n@@ -1199,10 +1191,7 @@ export default React.memo<BaseProps>(function ConnectedCameraModal(\nconst overlayContext = React.useContext(OverlayContext);\nconst inputState = React.useContext(InputStateContext);\nconst dispatch = useDispatch();\n- const getServerThreadID = useRealThreadCreator(\n- props.route.params.thread,\n- showErrorAlert,\n- );\n+\nreturn (\n<CameraModal\n{...props}\n@@ -1213,7 +1202,6 @@ export default React.memo<BaseProps>(function ConnectedCameraModal(\ndispatch={dispatch}\noverlayContext={overlayContext}\ninputState={inputState}\n- getServerThreadID={getServerThreadID}\n/>\n);\n});\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [lib] Delete useRealThreadCreator hook
Summary: Here and in D1139 the last usages were removed so we can delete the hook completely
Test Plan: Flow, tested with other diffs
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1140 |
129,191 | 11.05.2021 15:17:39 | -7,200 | 8715d2e89c87c0240a01902cd0628c5f57d6675f | [native] Replace OptimisticThreadInfo with ThreadInfo in camera modal
Summary: The same as in D1143, we can replace `OptimisticThreadInfo`
Test Plan: Create realized thread by sending an image using camera modal
Reviewers: ashoat
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-input-bar.react.js",
"new_path": "native/chat/chat-input-bar.react.js",
"diff": "@@ -652,10 +652,7 @@ class ChatInputBar extends React.PureComponent<Props, State> {\nname: CameraModalRouteName,\nparams: {\npresentedFrom: this.props.route.key,\n- thread: {\n- threadInfo: this.props.threadInfo,\n- sourceMessageID: this.props.route.params.sourceMessageID,\n- },\n+ thread: this.props.threadInfo,\n},\n});\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "native/media/camera-modal.react.js",
"new_path": "native/media/camera-modal.react.js",
"diff": "@@ -31,7 +31,7 @@ import { pathFromURI, filenameFromPathOrURI } from 'lib/media/file-utils';\nimport { useIsAppForegrounded } from 'lib/shared/lifecycle-utils';\nimport type { PhotoCapture } from 'lib/types/media-types';\nimport type { Dispatch } from 'lib/types/redux-types';\n-import type { OptimisticThreadInfo } from 'lib/types/thread-types';\n+import type { ThreadInfo } from 'lib/types/thread-types';\nimport ContentLoading from '../components/content-loading.react';\nimport ConnectedStatusBar from '../connected-status-bar.react';\n@@ -217,7 +217,7 @@ function runIndicatorAnimation(\nexport type CameraModalParams = {|\n+presentedFrom: string,\n- +thread: OptimisticThreadInfo,\n+ +thread: ThreadInfo,\n|};\ntype TouchableOpacityInstance = React.AbstractComponent<\n@@ -941,10 +941,7 @@ class CameraModal extends React.PureComponent<Props, State> {\nconst { inputState } = this.props;\ninvariant(inputState, 'inputState should be set');\n- inputState.sendMultimediaMessage(\n- [capture],\n- this.props.route.params.thread.threadInfo,\n- );\n+ inputState.sendMultimediaMessage([capture], this.props.route.params.thread);\n};\nclearPendingImage = () => {\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Replace OptimisticThreadInfo with ThreadInfo in camera modal
Summary: The same as in D1143, we can replace `OptimisticThreadInfo`
Test Plan: Create realized thread by sending an image using camera modal
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1144 |
129,191 | 11.05.2021 15:27:16 | -7,200 | ec1bdf54a4e7dab77100508cedc1744b68630b09 | [native] Replace OptimisticThreadInfo with ThreadInfo in image paste modal
Summary: As in D1143 and D1144
Test Plan: Send image using copy and paste to a pending thread
Reviewers: ashoat
Subscribers: KatPo, Adrian, atul | [
{
"change_type": "MODIFY",
"old_path": "native/chat/chat-input-bar.react.js",
"new_path": "native/chat/chat-input-bar.react.js",
"diff": "@@ -815,14 +815,11 @@ export default React.memo<BaseProps>(function ConnectedChatInputBar(\nname: ImagePasteModalRouteName,\nparams: {\nimagePasteStagingInfo: pastedImage,\n- thread: {\n- threadInfo: props.threadInfo,\n- sourceMessageID: props.route.params.sourceMessageID,\n- },\n+ thread: props.threadInfo,\n},\n});\n},\n- [props.navigation, props.route.params.sourceMessageID, props.threadInfo],\n+ [props.navigation, props.threadInfo],\n);\nReact.useEffect(() => {\n"
},
{
"change_type": "MODIFY",
"old_path": "native/chat/image-paste-modal.react.js",
"new_path": "native/chat/image-paste-modal.react.js",
"diff": "@@ -6,7 +6,7 @@ import { Button, View, Image } from 'react-native';\nimport filesystem from 'react-native-fs';\nimport type { PhotoPaste } from 'lib/types/media-types';\n-import type { OptimisticThreadInfo } from 'lib/types/thread-types';\n+import type { ThreadInfo } from 'lib/types/thread-types';\nimport sleep from 'lib/utils/sleep';\nimport Modal from '../components/modal.react';\n@@ -17,7 +17,7 @@ import { useStyles } from '../themes/colors';\nexport type ImagePasteModalParams = {|\n+imagePasteStagingInfo: PhotoPaste,\n- +thread: OptimisticThreadInfo,\n+ +thread: ThreadInfo,\n|};\ntype Props = {|\n@@ -30,7 +30,7 @@ function ImagePasteModal(props: Props) {\nconst {\nnavigation,\nroute: {\n- params: { imagePasteStagingInfo, thread },\n+ params: { imagePasteStagingInfo, thread: threadInfo },\n},\n} = props;\n@@ -38,12 +38,12 @@ function ImagePasteModal(props: Props) {\nnavigation.goBackOnce();\nconst selection: $ReadOnlyArray<PhotoPaste> = [imagePasteStagingInfo];\ninvariant(inputState, 'inputState should be set in ImagePasteModal');\n- await inputState.sendMultimediaMessage(selection, thread.threadInfo);\n+ await inputState.sendMultimediaMessage(selection, threadInfo);\ninvariant(\nimagePasteStagingInfo,\n'imagePasteStagingInfo should be set in ImagePasteModal',\n);\n- }, [imagePasteStagingInfo, inputState, navigation, thread]);\n+ }, [imagePasteStagingInfo, inputState, navigation, threadInfo]);\nconst cancel = React.useCallback(async () => {\nnavigation.goBackOnce();\n"
}
] | JavaScript | BSD 3-Clause New or Revised License | comme2e/comm | [native] Replace OptimisticThreadInfo with ThreadInfo in image paste modal
Summary: As in D1143 and D1144
Test Plan: Send image using copy and paste to a pending thread
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1145 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.