Minor tweaks
This commit is contained in:
parent
191e71c887
commit
8ccce58ddd
|
@ -70,7 +70,7 @@ import QueueListView from '../ee/omnichannel/views/QueueListView';
|
|||
import AddChannelTeamView from '../views/AddChannelTeamView';
|
||||
import AddExistingChannelView from '../views/AddExistingChannelView';
|
||||
import SelectListView from '../views/SelectListView';
|
||||
import DiscussionMessagesView from '../views/DiscussionMessagesView';
|
||||
import DiscussionsView from '../views/DiscussionsView';
|
||||
|
||||
// ChatsStackNavigator
|
||||
const ChatsStack = createStackNavigator();
|
||||
|
@ -85,10 +85,7 @@ const ChatsStackNavigator = () => {
|
|||
<ChatsStack.Screen name='RoomInfoView' component={RoomInfoView} options={RoomInfoView.navigationOptions} />
|
||||
<ChatsStack.Screen name='RoomInfoEditView' component={RoomInfoEditView} options={RoomInfoEditView.navigationOptions} />
|
||||
<ChatsStack.Screen name='RoomMembersView' component={RoomMembersView} options={RoomMembersView.navigationOptions} />
|
||||
<ChatsStack.Screen
|
||||
name='DiscussionMessagesView'
|
||||
component={DiscussionMessagesView}
|
||||
/>
|
||||
<ChatsStack.Screen name='DiscussionsView' component={DiscussionsView} />
|
||||
<ChatsStack.Screen
|
||||
name='SearchMessagesView'
|
||||
component={SearchMessagesView}
|
||||
|
|
|
@ -59,7 +59,7 @@ import QueueListView from '../../ee/omnichannel/views/QueueListView';
|
|||
import AddChannelTeamView from '../../views/AddChannelTeamView';
|
||||
import AddExistingChannelView from '../../views/AddExistingChannelView';
|
||||
import SelectListView from '../../views/SelectListView';
|
||||
import DiscussionMessagesView from '../../views/DiscussionMessagesView';
|
||||
import DiscussionsView from '../../views/DiscussionsView';
|
||||
import { ModalContainer } from './ModalContainer';
|
||||
|
||||
// ChatsStackNavigator
|
||||
|
@ -160,34 +160,12 @@ const ModalStackNavigator = React.memo(({ navigation }) => {
|
|||
component={ForwardLivechatView}
|
||||
options={ForwardLivechatView.navigationOptions}
|
||||
/>
|
||||
<ModalStack.Screen
|
||||
name='LivechatEditView'
|
||||
component={LivechatEditView}
|
||||
options={LivechatEditView.navigationOptions}
|
||||
/>
|
||||
<ModalStack.Screen
|
||||
name='PickerView'
|
||||
component={PickerView}
|
||||
options={PickerView.navigationOptions}
|
||||
/>
|
||||
<ModalStack.Screen
|
||||
name='ThreadMessagesView'
|
||||
component={ThreadMessagesView}
|
||||
/>
|
||||
<ModalStack.Screen
|
||||
name='DiscussionMessagesView'
|
||||
component={DiscussionMessagesView}
|
||||
/>
|
||||
<ModalStack.Screen
|
||||
name='TeamChannelsView'
|
||||
component={TeamChannelsView}
|
||||
options={TeamChannelsView.navigationOptions}
|
||||
/>
|
||||
<ModalStack.Screen
|
||||
name='MarkdownTableView'
|
||||
component={MarkdownTableView}
|
||||
options={MarkdownTableView.navigationOptions}
|
||||
/>
|
||||
<ModalStack.Screen name='LivechatEditView' component={LivechatEditView} options={LivechatEditView.navigationOptions} />
|
||||
<ModalStack.Screen name='PickerView' component={PickerView} options={PickerView.navigationOptions} />
|
||||
<ModalStack.Screen name='ThreadMessagesView' component={ThreadMessagesView} />
|
||||
<ModalStack.Screen name='DiscussionsView' component={DiscussionsView} />
|
||||
<ModalStack.Screen name='TeamChannelsView' component={TeamChannelsView} options={TeamChannelsView.navigationOptions} />
|
||||
<ModalStack.Screen name='MarkdownTableView' component={MarkdownTableView} options={MarkdownTableView.navigationOptions} />
|
||||
<ModalStack.Screen
|
||||
name='ReadReceiptsView'
|
||||
component={ReadReceiptsView}
|
||||
|
|
|
@ -23,9 +23,9 @@ import Message from '../containers/message';
|
|||
import RocketChat from '../lib/rocketchat';
|
||||
import SearchHeader from '../containers/SearchHeader';
|
||||
|
||||
const API_FETCH_COUNT = 25;
|
||||
const API_FETCH_COUNT = 50;
|
||||
|
||||
const DiscussionMessagesView = ({ navigation, route }) => {
|
||||
const DiscussionsView = ({ navigation, route }) => {
|
||||
const rid = route.params?.rid;
|
||||
const canAutoTranslate = route.params?.canAutoTranslate;
|
||||
const autoTranslate = route.params?.autoTranslate;
|
||||
|
@ -42,11 +42,12 @@ const DiscussionMessagesView = ({ navigation, route }) => {
|
|||
const [discussions, setDiscussions] = useState([]);
|
||||
const [search, setSearch] = useState([]);
|
||||
const [isSearching, setIsSearching] = useState(false);
|
||||
const [total, setTotal] = useState(0);
|
||||
|
||||
const { theme } = useTheme();
|
||||
const insets = useSafeAreaInsets();
|
||||
|
||||
const load = async(text = '') => {
|
||||
const load = async (text = '') => {
|
||||
if (loading) {
|
||||
return;
|
||||
}
|
||||
|
@ -63,8 +64,10 @@ const DiscussionMessagesView = ({ navigation, route }) => {
|
|||
if (result.success) {
|
||||
if (isSearching) {
|
||||
setSearch(result.messages);
|
||||
setTotal(result.total);
|
||||
} else {
|
||||
setDiscussions(result.messages);
|
||||
setTotal(result.total);
|
||||
}
|
||||
}
|
||||
setLoading(false);
|
||||
|
@ -74,7 +77,7 @@ const DiscussionMessagesView = ({ navigation, route }) => {
|
|||
}
|
||||
};
|
||||
|
||||
const onSearchChangeText = debounce(async(text) => {
|
||||
const onSearchChangeText = debounce(async text => {
|
||||
setIsSearching(true);
|
||||
await load(text);
|
||||
}, 300);
|
||||
|
@ -95,10 +98,7 @@ const DiscussionMessagesView = ({ navigation, route }) => {
|
|||
headerTitleAlign: 'left',
|
||||
headerLeft: () => (
|
||||
<HeaderButton.Container left>
|
||||
<HeaderButton.Item
|
||||
iconName='close'
|
||||
onPress={onCancelSearchPress}
|
||||
/>
|
||||
<HeaderButton.Item iconName='close' onPress={onCancelSearchPress} />
|
||||
</HeaderButton.Container>
|
||||
),
|
||||
headerTitle: () => (
|
||||
|
@ -119,11 +119,7 @@ const DiscussionMessagesView = ({ navigation, route }) => {
|
|||
|
||||
const options = {
|
||||
headerLeft: () => (
|
||||
<HeaderBackButton
|
||||
labelVisible={false}
|
||||
onPress={() => navigation.pop()}
|
||||
tintColor={themes[theme].headerTintColor}
|
||||
/>
|
||||
<HeaderBackButton labelVisible={false} onPress={() => navigation.pop()} tintColor={themes[theme].headerTintColor} />
|
||||
),
|
||||
headerTitleAlign: 'center',
|
||||
headerTitle: I18n.t('Discussions'),
|
||||
|
@ -154,12 +150,18 @@ const DiscussionMessagesView = ({ navigation, route }) => {
|
|||
navigation.setOptions(options);
|
||||
}, [navigation, isSearching]);
|
||||
|
||||
|
||||
const onDiscussionPress = debounce((item) => {
|
||||
const onDiscussionPress = debounce(
|
||||
item => {
|
||||
navigation.push('RoomView', {
|
||||
rid: item.drid, prid: item.rid, name: item.msg, t: 'p'
|
||||
rid: item.drid,
|
||||
prid: item.rid,
|
||||
name: item.msg,
|
||||
t: 'p'
|
||||
});
|
||||
}, 1000, true);
|
||||
},
|
||||
1000,
|
||||
true
|
||||
);
|
||||
|
||||
const renderItem = ({ item }) => (
|
||||
<Message
|
||||
|
@ -176,11 +178,7 @@ const DiscussionMessagesView = ({ navigation, route }) => {
|
|||
/>
|
||||
);
|
||||
if (!discussions?.length) {
|
||||
return (
|
||||
<>
|
||||
<BackgroundContainer text={I18n.t('No_discussions')} />
|
||||
</>
|
||||
);
|
||||
return <BackgroundContainer loading={loading} text={I18n.t('No_discussions')} />;
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -196,7 +194,7 @@ const DiscussionMessagesView = ({ navigation, route }) => {
|
|||
windowSize={10}
|
||||
initialNumToRender={7}
|
||||
removeClippedSubviews={isIOS}
|
||||
onEndReached={() => discussions.length > API_FETCH_COUNT ?? load()}
|
||||
onEndReached={() => total > API_FETCH_COUNT ?? load()}
|
||||
ItemSeparatorComponent={List.Separator}
|
||||
ListFooterComponent={loading ? <ActivityIndicator theme={theme} /> : null}
|
||||
scrollIndicatorInsets={{ right: 1 }}
|
||||
|
@ -205,7 +203,7 @@ const DiscussionMessagesView = ({ navigation, route }) => {
|
|||
);
|
||||
};
|
||||
|
||||
DiscussionMessagesView.propTypes = {
|
||||
DiscussionsView.propTypes = {
|
||||
navigation: PropTypes.object,
|
||||
route: PropTypes.object,
|
||||
item: PropTypes.shape({
|
||||
|
@ -213,4 +211,4 @@ DiscussionMessagesView.propTypes = {
|
|||
})
|
||||
};
|
||||
|
||||
export default DiscussionMessagesView;
|
||||
export default DiscussionsView;
|
|
@ -1004,7 +1004,7 @@ class RoomActionsView extends React.Component {
|
|||
title='Discussions'
|
||||
onPress={() =>
|
||||
this.onPressTouchable({
|
||||
route: 'DiscussionMessagesView',
|
||||
route: 'DiscussionsView',
|
||||
params: {
|
||||
rid,
|
||||
t,
|
||||
|
|
|
@ -171,24 +171,36 @@ describe('Discussion', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('Open Discussion from DiscussionMessagesView', () => {
|
||||
const discussionName = `${ data.random }message`;
|
||||
it('should go back to main room', async() => {
|
||||
describe('Open Discussion from DiscussionsView', () => {
|
||||
const discussionName = `${data.random}message`;
|
||||
it('should go back to main room', async () => {
|
||||
await tapBack();
|
||||
await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(5000);
|
||||
await waitFor(element(by.id('room-actions-view')))
|
||||
.toBeVisible()
|
||||
.withTimeout(5000);
|
||||
await tapBack();
|
||||
await waitFor(element(by.id(`room-view-title-${ discussionName }`))).toExist().withTimeout(5000);
|
||||
await waitFor(element(by.id(`room-view-title-${discussionName}`)))
|
||||
.toExist()
|
||||
.withTimeout(5000);
|
||||
await tapBack();
|
||||
await navigateToRoom();
|
||||
});
|
||||
|
||||
it('should navigate to DiscussionMessagesView', async() => {
|
||||
await waitFor(element(by.id(`room-view-title-${ channel }`))).toExist().withTimeout(5000);
|
||||
await waitFor(element(by.id('room-header'))).toBeVisible().withTimeout(5000);
|
||||
it('should navigate to DiscussionsView', async () => {
|
||||
await waitFor(element(by.id(`room-view-title-${channel}`)))
|
||||
.toExist()
|
||||
.withTimeout(5000);
|
||||
await waitFor(element(by.id('room-header')))
|
||||
.toBeVisible()
|
||||
.withTimeout(5000);
|
||||
await element(by.id('room-header')).tap();
|
||||
await waitFor(element(by.id('room-actions-discussions'))).toBeVisible().withTimeout(5000);
|
||||
await waitFor(element(by.id('room-actions-discussions')))
|
||||
.toBeVisible()
|
||||
.withTimeout(5000);
|
||||
await element(by.id('room-actions-discussions')).tap();
|
||||
await waitFor(element(by.id('discussion-messages-view'))).toBeVisible().withTimeout(5000);
|
||||
await waitFor(element(by.id('discussion-messages-view')))
|
||||
.toBeVisible()
|
||||
.withTimeout(5000);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -541,8 +541,35 @@ PODS:
|
|||
- TOCropViewController
|
||||
- RNLocalize (2.1.1):
|
||||
- React-Core
|
||||
- RNReanimated (1.9.0):
|
||||
- RNReanimated (2.2.0):
|
||||
- DoubleConversion
|
||||
- FBLazyVector
|
||||
- FBReactNativeSpec
|
||||
- glog
|
||||
- RCT-Folly
|
||||
- RCTRequired
|
||||
- RCTTypeSafety
|
||||
- React
|
||||
- React-callinvoker
|
||||
- React-Core
|
||||
- React-Core/DevSupport
|
||||
- React-Core/RCTWebSocket
|
||||
- React-CoreModules
|
||||
- React-cxxreact
|
||||
- React-jsi
|
||||
- React-jsiexecutor
|
||||
- React-jsinspector
|
||||
- React-RCTActionSheet
|
||||
- React-RCTAnimation
|
||||
- React-RCTBlob
|
||||
- React-RCTImage
|
||||
- React-RCTLinking
|
||||
- React-RCTNetwork
|
||||
- React-RCTSettings
|
||||
- React-RCTText
|
||||
- React-RCTVibration
|
||||
- ReactCommon/turbomodule/core
|
||||
- Yoga
|
||||
- RNRootView (1.0.3):
|
||||
- React
|
||||
- RNScreens (2.9.0):
|
||||
|
@ -940,7 +967,7 @@ SPEC CHECKSUMS:
|
|||
EXVideoThumbnails: cd257fc6e07884a704a5674d362a6410933acb68
|
||||
EXWebBrowser: d37a5ffdea1b65947352bc001dd9f732463725d4
|
||||
FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b
|
||||
FBReactNativeSpec: b427d2f482828b9533661dbcf9edf846cb60dc7b
|
||||
FBReactNativeSpec: 686ac17e193dcf7d5df4d772b224504dd2f3ad81
|
||||
Firebase: 919186c8e119dd9372a45fd1dd17a8a942bc1892
|
||||
FirebaseAnalytics: 5fa308e1b13f838d0f6dc74719ac2a72e8c5afc4
|
||||
FirebaseCore: 8cd4f8ea22075e0ee582849b1cf79d8816506085
|
||||
|
@ -1026,7 +1053,7 @@ SPEC CHECKSUMS:
|
|||
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
|
||||
RNImageCropPicker: 38865ab4af1b0b2146ad66061196bc0184946855
|
||||
RNLocalize: 82a569022724d35461e2dc5b5d015a13c3ca995b
|
||||
RNReanimated: b5ccb50650ba06f6e749c7c329a1bc3ae0c88b43
|
||||
RNReanimated: 9c13c86454bfd54dab7505c1a054470bfecd2563
|
||||
RNRootView: 895a4813dedeaca82db2fa868ca1c333d790e494
|
||||
RNScreens: c526239bbe0e957b988dacc8d75ac94ec9cb19da
|
||||
RNVectorIcons: 31cebfcf94e8cf8686eb5303ae0357da64d7a5a4
|
||||
|
|
Loading…
Reference in New Issue