Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Send multiple attachments #2162

Merged
merged 76 commits into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
8810543
[CHORE] Update react-native-image-crop-picker
djorkaeffalexandre Jun 2, 2020
10e549e
[CHORE] Update rn-extensions-share (2.4.0-rc.0)
djorkaeffalexandre Jun 2, 2020
0144565
[IMPROVEMENT] withoutServersView -> showErrorAlert
djorkaeffalexandre Jun 2, 2020
093efff
[TEMP] Cherry pick first item
djorkaeffalexandre Jun 2, 2020
0820d0c
[CHORE] Update rn-extensions-share (2.4.0-rc.1)
djorkaeffalexandre Jun 2, 2020
3f33779
[IMPROVEMENT] Remove some fetch-blob uses
djorkaeffalexandre Jun 2, 2020
2748591
[WIP] Initial send multiple files logic
djorkaeffalexandre Jun 2, 2020
264aef4
[WIP] Made images switchable
djorkaeffalexandre Jun 2, 2020
073832f
[WIP] Some share extension improvements
djorkaeffalexandre Jun 2, 2020
41ef5a9
[WIP] Add error styles
djorkaeffalexandre Jun 2, 2020
5bbb106
[WIP] Sending multiple files
djorkaeffalexandre Jun 3, 2020
a960723
[WIP] Add video thumbnails
djorkaeffalexandre Jun 3, 2020
6a733d6
[WIP] Show video component
djorkaeffalexandre Jun 3, 2020
31c09a0
[WIP] Share text
djorkaeffalexandre Jun 3, 2020
2af59b8
[WIP] Send text message (Share Extension)
djorkaeffalexandre Jun 3, 2020
fa14705
[WIP] Show list just when have more than one attachment
djorkaeffalexandre Jun 3, 2020
88a91f7
[WIP] Refactor code
djorkaeffalexandre Jun 3, 2020
c276153
[WIP] Add some comments
djorkaeffalexandre Jun 3, 2020
fb9feb5
[WIP] Fix thumbs height
djorkaeffalexandre Jun 3, 2020
a07e6d8
[WIP] Improve get thumbnail logic
djorkaeffalexandre Jun 3, 2020
c318c8b
Merge branch 'develop' into new.multiple-files
diegolmello Jun 17, 2020
57ec0ae
Header
diegolmello Jun 18, 2020
3c8c16e
Dynamic image component on ImageViewer
diegolmello Jun 18, 2020
2108f10
Few fixes
diegolmello Jun 18, 2020
97bf4ef
Header
diegolmello Jun 19, 2020
fa6ff9a
Use React.Component
diegolmello Jun 19, 2020
dff70e5
Fix user re-render using selector
diegolmello Jun 19, 2020
5c573dd
Fix header text color
diegolmello Jun 19, 2020
12eee87
Multiple files android
diegolmello Jun 19, 2020
3f083f9
Update rn-extensions-share ios
diegolmello Jun 19, 2020
26710b9
Stash
diegolmello Jun 19, 2020
669750e
Header
diegolmello Jun 22, 2020
b9c30cc
Set bottomViewColor equals to Thumbs when attachments > 1
diegolmello Jun 22, 2020
5a82237
Messagebox sCU
diegolmello Jun 22, 2020
274ca39
ImagePreview
diegolmello Jun 22, 2020
dd6d17d
Overflow hidden on MessageImage
diegolmello Jun 22, 2020
191c098
AttachmentView tweaks
diegolmello Jun 22, 2020
9c18ed7
lint
diegolmello Jun 22, 2020
592b56f
Refactoring remove button
diegolmello Jun 22, 2020
3dc3178
Thumb button
diegolmello Jun 23, 2020
251bf3c
Remove item
diegolmello Jun 23, 2020
2c496a0
Remove Thumbs background
diegolmello Jun 23, 2020
4184a98
Video preview and thumb
diegolmello Jun 23, 2020
4049493
File preview
diegolmello Jun 23, 2020
07622db
One description per thumb
diegolmello Jun 23, 2020
4e73c6c
Key extractor
diegolmello Jun 23, 2020
325d850
Call ShareView on take photo/video
diegolmello Jun 23, 2020
2747a95
Remove UploadModal
diegolmello Jun 23, 2020
84bcb07
Messagebox sCU
diegolmello Jun 23, 2020
564507c
isActionsEnabled on Messagebox
diegolmello Jun 23, 2020
0bd6723
Apply DimensionsContext on share extension
diegolmello Jun 23, 2020
ceb4ac7
Send text
diegolmello Jun 23, 2020
398733a
Minor fix for read only
diegolmello Jun 24, 2020
c817e54
Read only on ShareView
diegolmello Jun 24, 2020
6803b51
Fix threads
diegolmello Jun 24, 2020
b0d4089
Fix ref when using withActionSheet
diegolmello Jun 24, 2020
f073faf
Handle description
diegolmello Jun 24, 2020
25aaa40
typing and key tracking
diegolmello Jun 24, 2020
3620459
Unnecessary getCustomEmoji implementation
diegolmello Jun 24, 2020
669c05c
Fix empty filenames
diegolmello Jun 24, 2020
1afe6a0
Fix tablet
diegolmello Jun 24, 2020
8f554a2
Prevent unnecessary render
diegolmello Jun 24, 2020
87af8da
Minor refactor
diegolmello Jun 24, 2020
376267e
Stop showing preview when image is too big
diegolmello Jun 25, 2020
02e92f7
Fix avatar
diegolmello Jun 25, 2020
c0b8b78
Fix type icon
diegolmello Jun 25, 2020
c9712f1
Remove first animation from share extension
diegolmello Jun 25, 2020
b57e192
Apply theme on read only text
diegolmello Jun 25, 2020
e2c8799
Fix remove file logic
diegolmello Jun 25, 2020
9cc6938
shareExtension -> isShareExtension
diegolmello Jun 25, 2020
be00f7f
Remove error logic from ShareListView
diegolmello Jun 25, 2020
8b1135d
Minor fix for omnichannel icon
diegolmello Jun 25, 2020
635e4c4
Can upload logic
diegolmello Jun 25, 2020
2b7163c
Fix Android permission
diegolmello Jun 26, 2020
b0def4c
Preview 3MB
diegolmello Jun 26, 2020
7693629
Few fixes
diegolmello Jun 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@
package="chat.rocket.reactnative">

<uses-permission android:name="android.permission.INTERNET" />
<!-- <uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" /> -->
<!-- <uses-permission-sdk-23 android:name="android.permission.VIBRATE"/> -->

<application
android:name=".MainApplication"
Expand Down Expand Up @@ -65,6 +60,7 @@
android:theme="@style/AppTheme" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public List<Package> getPackageList() {
new expo.modules.keepawake.KeepAwakePackage(),
new expo.modules.localauthentication.LocalAuthenticationPackage(),
new expo.modules.permissions.PermissionsPackage(),
new expo.modules.videothumbnails.VideoThumbnailsPackage(),
new expo.modules.webbrowser.WebBrowserPackage()
);
}
Expand Down
12 changes: 9 additions & 3 deletions app/constants/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export const themes = {
passcodePrimary: '#2F343D',
passcodeSecondary: '#6C727A',
passcodeDotEmpty: '#CBCED1',
passcodeDotFull: '#6C727A'
passcodeDotFull: '#6C727A',
previewBackground: '#1F2329',
previewTintColor: '#ffffff'
},
dark: {
backgroundColor: '#030b1b',
Expand Down Expand Up @@ -95,7 +97,9 @@ export const themes = {
passcodePrimary: '#FFFFFF',
passcodeSecondary: '#CBCED1',
passcodeDotEmpty: '#CBCED1',
passcodeDotFull: '#6C727A'
passcodeDotFull: '#6C727A',
previewBackground: '#030b1b',
previewTintColor: '#ffffff'
},
black: {
backgroundColor: '#000000',
Expand Down Expand Up @@ -137,6 +141,8 @@ export const themes = {
passcodePrimary: '#FFFFFF',
passcodeSecondary: '#CBCED1',
passcodeDotEmpty: '#CBCED1',
passcodeDotFull: '#6C727A'
passcodeDotFull: '#6C727A',
previewBackground: '#000000',
previewTintColor: '#ffffff'
}
};
17 changes: 6 additions & 11 deletions app/containers/ActionSheet/Provider.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useRef, useContext } from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import React, { useRef, useContext, forwardRef } from 'react';
import PropTypes from 'prop-types';

import ActionSheet from './ActionSheet';
Expand All @@ -14,15 +13,11 @@ export const useActionSheet = () => useContext(context);

const { Provider, Consumer } = context;

export const withActionSheet = (Component) => {
const ConnectedActionSheet = props => (
<Consumer>
{contexts => <Component {...props} {...contexts} />}
</Consumer>
);
hoistNonReactStatics(ConnectedActionSheet, Component);
return ConnectedActionSheet;
};
export const withActionSheet = Component => forwardRef((props, ref) => (
<Consumer>
{contexts => <Component {...props} {...contexts} ref={ref} />}
</Consumer>
));

export const ActionSheetProvider = React.memo(({ children }) => {
const ref = useRef();
Expand Down
13 changes: 12 additions & 1 deletion app/containers/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,22 @@ import { SafeAreaView } from 'react-native-safe-area-context';
import { View, StyleSheet } from 'react-native';
import { themes } from '../../constants/colors';
import { themedHeader } from '../../utils/navigation';
import { isIOS } from '../../utils/deviceInfo';
import { isIOS, isTablet } from '../../utils/deviceInfo';

// Get from https://github.com/react-navigation/react-navigation/blob/master/packages/stack/src/views/Header/HeaderSegment.tsx#L69
export const headerHeight = isIOS ? 44 : 56;

export const getHeaderHeight = (isLandscape) => {
if (isIOS) {
if (isLandscape && !isTablet) {
return 32;
} else {
return 44;
}
}
return 56;
};

const styles = StyleSheet.create({
container: {
height: headerHeight,
Expand Down
10 changes: 6 additions & 4 deletions app/containers/HeaderButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ export const DrawerButton = React.memo(({ navigation, testID, ...otherProps }) =
</CustomHeaderButtons>
));

export const CloseModalButton = React.memo(({ navigation, testID, onPress = () => navigation.pop() }) => (
export const CloseModalButton = React.memo(({
navigation, testID, onPress = () => navigation.pop(), ...props
}) => (
<CustomHeaderButtons left>
<Item title='close' iconName='Cross' onPress={onPress} testID={testID} />
<Item title='close' iconName='Cross' onPress={onPress} testID={testID} {...props} />
</CustomHeaderButtons>
));

Expand All @@ -57,9 +59,9 @@ export const MoreButton = React.memo(({ onPress, testID }) => (
</CustomHeaderButtons>
));

export const SaveButton = React.memo(({ onPress, testID }) => (
export const SaveButton = React.memo(({ onPress, testID, ...props }) => (
<CustomHeaderButtons>
<Item title='save' iconName='download' onPress={onPress} testID={testID} />
<Item title='save' iconName='download' onPress={onPress} testID={testID} {...props} />
</CustomHeaderButtons>
));

Expand Down
12 changes: 9 additions & 3 deletions app/containers/MessageBox/LeftButtons.ios.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
import React from 'react';
import PropTypes from 'prop-types';
import { View } from 'react-native';

import { CancelEditingButton, ActionsButton } from './buttons';
import styles from './styles';

const LeftButtons = React.memo(({
theme, showMessageBoxActions, editing, editCancel
theme, showMessageBoxActions, editing, editCancel, isActionsEnabled
}) => {
if (editing) {
return <CancelEditingButton onPress={editCancel} theme={theme} />;
}
return <ActionsButton onPress={showMessageBoxActions} theme={theme} />;
if (isActionsEnabled) {
return <ActionsButton onPress={showMessageBoxActions} theme={theme} />;
}
return <View style={styles.buttonsWhitespace} />;
});

LeftButtons.propTypes = {
theme: PropTypes.string,
showMessageBoxActions: PropTypes.func.isRequired,
editing: PropTypes.bool,
editCancel: PropTypes.func.isRequired
editCancel: PropTypes.func.isRequired,
isActionsEnabled: PropTypes.bool
};

export default LeftButtons;
4 changes: 2 additions & 2 deletions app/containers/MessageBox/Recording.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import { AudioRecorder, AudioUtils } from 'react-native-audio';
import { BorderlessButton } from 'react-native-gesture-handler';
import { activateKeepAwake, deactivateKeepAwake } from 'expo-keep-awake';
import RNFetchBlob from 'rn-fetch-blob';
import * as FileSystem from 'expo-file-system';

import styles from './styles';
import I18n from '../../i18n';
Expand Down Expand Up @@ -113,7 +113,7 @@ export default class extends React.PureComponent {
this.recording = false;
const filePath = await AudioRecorder.stopRecording();
if (isAndroid) {
const data = await RNFetchBlob.fs.stat(decodeURIComponent(filePath));
const data = await FileSystem.getInfoAsync(decodeURIComponent(filePath), { size: true });
this.finishRecording(true, filePath, data.size);
}
} catch (err) {
Expand Down
15 changes: 9 additions & 6 deletions app/containers/MessageBox/RightButtons.android.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import React from 'react';
import PropTypes from 'prop-types';
import { View } from 'react-native';

import { SendButton, AudioButton, ActionsButton } from './buttons';
import styles from './styles';

const RightButtons = React.memo(({
theme, showSend, submit, recordAudioMessage, recordAudioMessageEnabled, showMessageBoxActions
theme, showSend, submit, recordAudioMessage, recordAudioMessageEnabled, showMessageBoxActions, isActionsEnabled
}) => {
if (showSend) {
return <SendButton onPress={submit} theme={theme} />;
}
if (recordAudioMessageEnabled) {
if (recordAudioMessageEnabled || isActionsEnabled) {
return (
<>
<AudioButton onPress={recordAudioMessage} theme={theme} />
<ActionsButton onPress={showMessageBoxActions} theme={theme} />
{recordAudioMessageEnabled ? <AudioButton onPress={recordAudioMessage} theme={theme} /> : null}
{isActionsEnabled ? <ActionsButton onPress={showMessageBoxActions} theme={theme} /> : null}
</>
);
}
return <ActionsButton onPress={showMessageBoxActions} theme={theme} />;
return <View style={styles.buttonsWhitespace} />;
});

RightButtons.propTypes = {
Expand All @@ -26,7 +28,8 @@ RightButtons.propTypes = {
submit: PropTypes.func.isRequired,
recordAudioMessage: PropTypes.func.isRequired,
recordAudioMessageEnabled: PropTypes.bool,
showMessageBoxActions: PropTypes.func.isRequired
showMessageBoxActions: PropTypes.func.isRequired,
isActionsEnabled: PropTypes.bool
};

export default RightButtons;
Loading