Unverified Commit b75e192e authored by Reinaldo Neto's avatar Reinaldo Neto Committed by GitHub
Browse files

[IMPROVE] Remove Omnichannel visitor's navigation history (#3534)



Co-authored-by: default avatarDiego Mello <diegolmello@gmail.com>
parent 1ea6fe11
......@@ -328,7 +328,6 @@
"N_users": "{{n}} مستخدمين",
"N_channels": "{{n}} القنوات",
"Name": "اسم",
"Navigation_history": "تاريخ التصفح",
"Never": "أبداً",
"New_Message": "رسالة جديدة",
"New_Password": "كلمة مرور جديدة",
......
......@@ -330,7 +330,6 @@
"N_users": "{{n}} Benutzer",
"N_channels": "{{n}} Kanäle",
"Name": "Name",
"Navigation_history": "Navigations-Verlauf",
"Never": "Niemals",
"New_Message": "Neue Nachricht",
"New_Password": "Neues Kennwort",
......
......@@ -331,7 +331,6 @@
"N_users": "{{n}} users",
"N_channels": "{{n}} channels",
"Name": "Name",
"Navigation_history": "Navigation history",
"Never": "Never",
"New_Message": "New Message",
"New_Password": "New Password",
......
......@@ -330,7 +330,6 @@
"N_users": "{{n}} utilisateurs",
"N_channels": "{{n}} canaux",
"Name": "Nom",
"Navigation_history": "Historique de navigation",
"Never": "Jamais",
"New_Message": "Nouveau message",
"New_Password": "Nouveau mot de passe",
......
......@@ -322,7 +322,6 @@
"N_people_reacted": "{{n}} persone hanno reagito",
"N_users": "{{n}} utenti",
"Name": "Nome",
"Navigation_history": "Cronologia di navigazione",
"Never": "Mai",
"New_Message": "Nuovo messaggio",
"New_Password": "Nuova password",
......
......@@ -330,7 +330,6 @@
"N_users": "{{n}} gebruikers",
"N_channels": "{{n}} kanalen",
"Name": "Naam",
"Navigation_history": "Navigatie geschiedenis",
"Never": "Nooit",
"New_Message": "Nieuw bericht",
"New_Password": "Nieuw wachtwoord",
......
......@@ -309,7 +309,6 @@
"N_users": "{{n}} usuários",
"N_channels": "{{n}} canais",
"Name": "Nome",
"Navigation_history": "Histórico de navegação",
"Never": "Nunca",
"New_Message": "Nova Mensagem",
"New_Password": "Nova Senha",
......
......@@ -329,7 +329,6 @@
"N_users": "{{n}} utilizadores",
"N_channels": "{{n}} canais",
"Name": "Nome",
"Navigation_history": "Histórico de navegação",
"Never": "Nunca",
"New_Message": "Nova Mensagem",
"New_Password": "Nova Palavra-passe",
......
......@@ -330,7 +330,6 @@
"N_users": "{{n}} пользователи",
"N_channels": "{{n}} каналов",
"Name": "Имя",
"Navigation_history": "История навигации",
"Never": "Никогда",
"New_Message": "Новое сообщение",
"New_Password": "Новый пароль",
......
......@@ -323,7 +323,6 @@
"N_people_reacted": "{{n}} kişi tepki verdi",
"N_users": "{{n}} kullanıcı",
"Name": "İsim",
"Navigation_history": "Gezinti geçmişi",
"Never": "Asla",
"New_Message": "Yeni İleti",
"New_Password": "Yeni Şifre",
......
......@@ -320,7 +320,6 @@
"N_people_reacted": "{{n}} 人回复",
"N_users": "{{n}} 位用户",
"Name": "名称",
"Navigation_history": "浏览历史记录",
"Never": "从不",
"New_Message": "新信息",
"New_Password": "新密码",
......
......@@ -321,7 +321,6 @@
"N_people_reacted": "{{n}} 人回复",
"N_users": "{{n}} 位使用者",
"Name": "名稱",
"Navigation_history": "瀏覽歷史記錄",
"Never": "從不",
"New_Message": "新訊息",
"New_Password": "新密碼",
......
......@@ -1138,10 +1138,6 @@ const RocketChat = {
// RC 0.36.0
return this.methodCallWrapper('livechat:transfer', transferData);
},
getPagesLivechat(rid, offset) {
// RC 2.3.0
return this.sdk.get(`livechat/visitors.pagesVisited/${rid}?count=50&offset=${offset}`);
},
getDepartmentInfo(departmentId) {
// RC 2.2.0
return this.sdk.get(`livechat/department/${departmentId}?includeAgents=false`);
......
......@@ -21,7 +21,6 @@ import MessagesView from '../views/MessagesView';
import AutoTranslateView from '../views/AutoTranslateView';
import DirectoryView from '../views/DirectoryView';
import NotificationPrefView from '../views/NotificationPreferencesView';
import VisitorNavigationView from '../views/VisitorNavigationView';
import ForwardLivechatView from '../views/ForwardLivechatView';
import LivechatEditView from '../views/LivechatEditView';
import PickerView from '../views/PickerView';
......@@ -114,11 +113,6 @@ const ChatsStackNavigator = () => {
component={NotificationPrefView}
options={NotificationPrefView.navigationOptions}
/>
<ChatsStack.Screen
name='VisitorNavigationView'
component={VisitorNavigationView}
options={VisitorNavigationView.navigationOptions}
/>
<ChatsStack.Screen
name='ForwardLivechatView'
component={ForwardLivechatView}
......
......@@ -20,7 +20,6 @@ import MessagesView from '../../views/MessagesView';
import AutoTranslateView from '../../views/AutoTranslateView';
import DirectoryView from '../../views/DirectoryView';
import NotificationPrefView from '../../views/NotificationPreferencesView';
import VisitorNavigationView from '../../views/VisitorNavigationView';
import ForwardLivechatView from '../../views/ForwardLivechatView';
import CannedResponsesListView from '../../views/CannedResponsesListView';
import CannedResponseDetail from '../../views/CannedResponseDetail';
......@@ -158,11 +157,6 @@ const ModalStackNavigator = React.memo(({ navigation }: INavigation) => {
component={NotificationPrefView}
options={NotificationPrefView.navigationOptions}
/>
<ModalStack.Screen
name='VisitorNavigationView'
component={VisitorNavigationView}
options={VisitorNavigationView.navigationOptions}
/>
<ModalStack.Screen
name='ForwardLivechatView'
component={ForwardLivechatView}
......
......@@ -97,9 +97,6 @@ export type ModalStackParamList = {
rid: string;
room: IRoom;
};
VisitorNavigationView: {
rid: string;
};
ForwardLivechatView: {
rid: string;
};
......
......@@ -86,9 +86,6 @@ export type ChatsStackParamList = {
rid: string;
room: Model;
};
VisitorNavigationView: {
rid: string;
};
ForwardLivechatView: {
rid: string;
};
......
......@@ -253,7 +253,6 @@ export default {
RA_GO_AUTOTRANSLATE: 'ra_go_autotranslate',
RA_GO_NOTIFICATIONPREF: 'ra_go_notification_pref',
RA_GO_FORWARDLIVECHAT: 'ra_go_forward_livechat',
RA_GO_VISITORNAVIGATION: 'ra_go_visitor_navigation',
RA_SHARE: 'ra_share',
RA_LEAVE: 'ra_leave',
RA_LEAVE_F: 'ra_leave_f',
......
......@@ -1197,23 +1197,6 @@ class RoomActionsView extends React.Component {
<List.Separator />
</>
) : null}
{['l'].includes(t) && !this.isOmnichannelPreview ? (
<>
<List.Item
title='Navigation_history'
onPress={() =>
this.onPressTouchable({
route: 'VisitorNavigationView',
params: { rid }
})
}
left={() => <List.Icon name='history' />}
showActionIndicator
/>
<List.Separator />
</>
) : null}
</List.Section>
{this.renderLastSection()}
......
import React, { useEffect, useState } from 'react';
import { FlatList, StyleSheet, Text } from 'react-native';
import PropTypes from 'prop-types';
import { withTheme } from '../theme';
import RocketChat from '../lib/rocketchat';
import { themes } from '../constants/colors';
import openLink from '../utils/openLink';
import I18n from '../i18n';
import debounce from '../utils/debounce';
import * as List from '../containers/List';
import SafeAreaView from '../containers/SafeAreaView';
import sharedStyles from './Styles';
const styles = StyleSheet.create({
noResult: {
fontSize: 16,
paddingVertical: 56,
...sharedStyles.textSemibold,
...sharedStyles.textAlignCenter
}
});
const Item = ({ item }) => (
<List.Item
title={item.navigation?.page?.title || I18n.t('Empty_title')}
onPress={() => openLink(item.navigation?.page?.location?.href)}
translateTitle={false}
/>
);
Item.propTypes = {
item: PropTypes.object
};
const VisitorNavigationView = ({ route, theme }) => {
let offset;
let total = 0;
const [pages, setPages] = useState([]);
const getPages = async () => {
const rid = route.params?.rid;
if (rid) {
try {
const result = await RocketChat.getPagesLivechat(rid, offset);
if (result.success) {
setPages(result.pages);
offset = result.pages.length;
({ total } = result);
}
} catch {
// do nothig
}
}
};
useEffect(() => {
getPages();
}, []);
const onEndReached = debounce(() => {
if (pages.length <= total) {
getPages();
}
}, 300);
return (
<SafeAreaView>
<FlatList
data={pages}
renderItem={({ item }) => <Item item={item} theme={theme} />}
ItemSeparatorComponent={List.Separator}
ListFooterComponent={List.Separator}
ListHeaderComponent={List.Separator}
contentContainerStyle={List.styles.contentContainerStyleFlatList}
ListEmptyComponent={() => (
<Text style={[styles.noResult, { color: themes[theme].titleText }]}>{I18n.t('No_results_found')}</Text>
)}
keyExtractor={item => item}
onEndReached={onEndReached}
onEndReachedThreshold={5}
/>
</SafeAreaView>
);
};
VisitorNavigationView.propTypes = {
theme: PropTypes.string,
route: PropTypes.object
};
VisitorNavigationView.navigationOptions = {
title: I18n.t('Navigation_history')
};
export default withTheme(VisitorNavigationView);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment