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

feat: troubleshoot notification #5198

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
22 changes: 21 additions & 1 deletion app/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -744,5 +744,25 @@
"Incoming_call_from": "Incoming call from",
"Call_started": "Call started",
"Message_has_been_shared":"Message has been shared",
"No_channels_in_team": "No Channels on this team"
"No_channels_in_team": "No Channels on this team",
"Push_Troubleshooting": "Push Troubleshooting",
"Device_notification_settings": "Device notification settings",
"Allow_push_notifications_for_rocket_chat": "Allow push notifications for Rocket.Chat",
"Go_to_device_settings": "Go to device settings",
"Community_edition_push_quota": "Community Edition push quota",
"Workspace_consumption": "Workspace consumption",
"Workspace_consumption_description": "There's a set amount of push of allowed push notifications per month",
"Push_gateway_connection": "Push Gateway Connection",
"Custom_push_gateway_connection": "Custom Gateway Connection",
"Test_push_notification": "Test push notification",
"Push_gateway_connected_description": "Send a push notification to yourself to check if the gateway is working",
"Push_gateway_not_connected_description": "We're not able to connect to the push gateway. If this issue persists please check with your workspace administrator.",
"Custom_push_gateway_connected_description": "Your workspace uses a custom push notification gateway. Check with your workspace administrator for any issues.",
"Notification_delay": "Notification delay",
"Documentation": "Documentation",
"Notification_delay_description": "There are factors that can contribute to delayed notifications. Learn more in Rocket.Chat's docs.",
"Device_notifications_alert_title": "Notifications disabled",
"Device_notifications_alert_description": "Please go to your settings app and enable notifications for Rocket.Chat",
"Push_consumption_alert_title": "You can be limitless",
"Push_consumption_alert_description":"Talk to your workspace administrator about upgrading, and forget about notification limits!"
}
25 changes: 23 additions & 2 deletions app/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,27 @@
"Select": "Selecionar",
"Nickname": "Apelido",
"Bio": "Biografia",
"Message_has_been_shared":"Menssagem foi compartilhada",
"No_channels_in_team": "Nenhum canal nesta equipe"
"Message_has_been_shared":"Mensagem foi compartilhada",
"No_channels_in_team": "Nenhum canal nesta equipe",
"Push_Troubleshooting": "Solucionar Problemas de Push",
"Device_notification_settings": "Configurações de notificações do dispositivo",
"Allow_push_notifications_for_rocket_chat": "Permitir notificações push para o Rocket.Chat",
"Go_to_device_settings": "Ir para configurações do dispositivo",
"Community_edition_push_quota": "Cota de notificações push Community Edition",
"Workspace_consumption": "Consumo do Workspace",
"Workspace_consumption_description": "Existe uma quantidade definida de notificações push permitidas por mês.",
"Push_gateway_connection": "Conexão com o Gateway de Push",
"Custom_push_gateway_connection": "Conexão Personalizada com o Gateway",
"Test_push_notification": "Testar notificação push",
"Push_gateway_connected_description": "Envie uma notificação push para si mesmo para verificar se o gateway está funcionando.",
"Push_gateway_not_connected_description": "Não conseguimos conectar ao gateway de push. Se esse problema persistir, por favor, verifique com o administrador do seu workspace.",
"Custom_push_gateway_connected_description": "Seu workspace utiliza um gateway de notificação push personalizado. Verifique com o administrador do seu workspace se há algum problema.",
"Notification_delay": "Atraso de notificação",
"Documentation": "Documentação",
"Notification_delay_description": "Existem fatores que podem contribuir para atrasos nas notificações. Saiba mais na documentação do Rocket.Chat.",
"Device_notifications_alert_title": "Notificações desativadas",
"Device_notifications_alert_description": "Por favor, vá para o aplicativo de configurações e habilite as notificações para o Rocket.Chat.",
"Push_consumption_alert_title": "Você pode ser ilimitado",
"Push_consumption_alert_description": "Converse com o administrador do seu workspace sobre uma atualização e esqueça os limites de notificação!"

}
21 changes: 18 additions & 3 deletions app/lib/constants/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ export const SWITCH_TRACK_COLOR = {
true: '#2de0a5'
};

const pushTroubleshooting = {
pushConsumptionOnSuccess: '#148660',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use figma colors name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, but there are already successColor and dangerColor in this file, if I just added onSuccess or onDanger it would be weird. The dangerColor is used in other places of the app and the difference between the names will be minimal, but there is a difference between the colors. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not strange, the right thing is to correct the mistake of the past and not make the same mistake again because it was wrong in the past.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even a good thing would be to check the colors used in figma, Jose is using some deprecated colors, you could ask him to change and use the colors that are already in the new design system.

pushConsumptionOnWarning: '#8E6300',
pushConsumptionOnDanger: '#9B1325',
pushTroubleshootingSuccess: '#2DE0A5',
pushTroubleshootingDanger: '#F5455C',
pushTroubleshootingWarning: '#FFD031'
};

const mentions = {
unreadColor: '#6C727A',
tunreadColor: '#1d74f5',
Expand Down Expand Up @@ -102,8 +111,10 @@ export const colors = {
statusBackgroundWarning: '#FFECAD',
statusFontOnWarning: '#B88D00',
overlayColor: '#1F2329B2',
fontAnnotation: '#9EA2A8',
...mentions,
...callButtons
...callButtons,
...pushTroubleshooting
},
dark: {
backgroundColor: '#030b1b',
Expand Down Expand Up @@ -181,8 +192,10 @@ export const colors = {
statusBackgroundWarning: '#FFECAD',
statusFontOnWarning: '#B88D00',
overlayColor: '#1F2329B2',
fontAnnotation: '#9EA2A8',
...mentions,
...callButtons
...callButtons,
...pushTroubleshooting
},
black: {
backgroundColor: '#000000',
Expand Down Expand Up @@ -260,8 +273,10 @@ export const colors = {
statusBackgroundWarning: '#FFECAD',
statusFontOnWarning: '#B88D00',
overlayColor: '#1F2329B2',
fontAnnotation: '#9EA2A8',
...mentions,
...callButtons
...callButtons,
...pushTroubleshooting
}
};

Expand Down
4 changes: 4 additions & 0 deletions app/stacks/InsideStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import DisplayPrefsView from '../views/DisplayPrefsView';
// Settings Stack
import SettingsView from '../views/SettingsView';
import SecurityPrivacyView from '../views/SecurityPrivacyView';
import PushTroubleshootView from '../views/PushTroubleshootView';
import E2EEncryptionSecurityView from '../views/E2EEncryptionSecurityView';
import LanguageView from '../views/LanguageView';
import ThemeView from '../views/ThemeView';
Expand Down Expand Up @@ -115,6 +116,7 @@ const ChatsStackNavigator = () => {
<ChatsStack.Screen name='AutoTranslateView' component={AutoTranslateView} />
<ChatsStack.Screen name='DirectoryView' component={DirectoryView} options={DirectoryView.navigationOptions} />
<ChatsStack.Screen name='NotificationPrefView' component={NotificationPrefView} />
<ChatsStack.Screen name='PushTroubleshootView' component={PushTroubleshootView} />
<ChatsStack.Screen name='ForwardLivechatView' component={ForwardLivechatView} />
<ChatsStack.Screen name='CloseLivechatView' component={CloseLivechatView} />
<ChatsStack.Screen name='LivechatEditView' component={LivechatEditView} options={LivechatEditView.navigationOptions} />
Expand Down Expand Up @@ -152,6 +154,7 @@ const ProfileStackNavigator = () => {
<ProfileStack.Screen name='UserPreferencesView' component={UserPreferencesView} />
<ProfileStack.Screen name='ChangeAvatarView' component={ChangeAvatarView} />
<ProfileStack.Screen name='UserNotificationPrefView' component={UserNotificationPrefView} />
<ProfileStack.Screen name='PushTroubleshootView' component={PushTroubleshootView} />
<ProfileStack.Screen name='PickerView' component={PickerView} />
</ProfileStack.Navigator>
);
Expand All @@ -168,6 +171,7 @@ const SettingsStackNavigator = () => {
>
<SettingsStack.Screen name='SettingsView' component={SettingsView} />
<SettingsStack.Screen name='SecurityPrivacyView' component={SecurityPrivacyView} />
<SettingsStack.Screen name='PushTroubleshootView' component={PushTroubleshootView} />
<SettingsStack.Screen name='E2EEncryptionSecurityView' component={E2EEncryptionSecurityView} />
<SettingsStack.Screen name='LanguageView' component={LanguageView} />
<SettingsStack.Screen name='ThemeView' component={ThemeView} />
Expand Down
2 changes: 2 additions & 0 deletions app/stacks/MasterDetailStack/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import MessagesView from '../../views/MessagesView';
import AutoTranslateView from '../../views/AutoTranslateView';
import DirectoryView from '../../views/DirectoryView';
import NotificationPrefView from '../../views/NotificationPreferencesView';
import PushTroubleshootView from '../../views/PushTroubleshootView';
import ForwardLivechatView from '../../views/ForwardLivechatView';
import ForwardMessageView from '../../views/ForwardMessageView';
import CloseLivechatView from '../../views/CloseLivechatView';
Expand Down Expand Up @@ -196,6 +197,7 @@ const ModalStackNavigator = React.memo(({ navigation }: INavigation) => {
<ModalStack.Screen name='SecurityPrivacyView' component={SecurityPrivacyView} />
<ModalStack.Screen name='MediaAutoDownloadView' component={MediaAutoDownloadView} />
<ModalStack.Screen name='E2EEncryptionSecurityView' component={E2EEncryptionSecurityView} />
<ModalStack.Screen name='PushTroubleshootView' component={PushTroubleshootView} />
</ModalStack.Navigator>
</ModalContainer>
);
Expand Down
1 change: 1 addition & 0 deletions app/stacks/MasterDetailStack/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ export type ModalStackParamList = {
SecurityPrivacyView: undefined;
MediaAutoDownloadView: undefined;
E2EEncryptionSecurityView: undefined;
PushTroubleshootView: undefined;
};

export type MasterDetailInsideStackParamList = {
Expand Down
3 changes: 3 additions & 0 deletions app/stacks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export type ChatsStackParamList = {
rid: string;
room: TSubscriptionModel;
};
PushTroubleshootView: undefined;
CloseLivechatView: {
rid: string;
departmentId?: string;
Expand Down Expand Up @@ -177,6 +178,7 @@ export type ProfileStackParamList = {
ProfileView: undefined;
UserPreferencesView: undefined;
UserNotificationPrefView: undefined;
PushTroubleshootView: undefined;
ChangeAvatarView: {
context: TChangeAvatarViewContext;
titleHeader?: string;
Expand All @@ -196,6 +198,7 @@ export type SettingsStackParamList = {
ProfileView: undefined;
DisplayPrefsView: undefined;
MediaAutoDownloadView: undefined;
PushTroubleshootView: undefined;
};

export type AdminPanelStackParamList = {
Expand Down
52 changes: 52 additions & 0 deletions app/views/PushTroubleshootView/components/CustomListSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import React from 'react';
import { StyleSheet, View } from 'react-native';

import { Header } from '../../../containers/List';

const styles = StyleSheet.create({
container: {
marginBottom: 16
},
headerContainer: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center'
},
statusContainer: {
width: 10,
height: 10,
borderRadius: 5,
marginRight: 12
}
});

interface ICustomListSection {
children: (React.ReactElement | null)[] | React.ReactElement | null;
title: string;
translateTitle?: boolean;
statusColor?: string;
}

const CustomHeader = ({
title,
translateTitle,
statusColor
}: {
title: string;
translateTitle?: boolean;
statusColor?: string;
}) => (
<View style={styles.headerContainer}>
<Header {...{ title, translateTitle }} />
{statusColor ? <View style={[styles.statusContainer, { backgroundColor: statusColor }]} /> : null}
</View>
);

const CustomListSection = ({ children, title, translateTitle, statusColor }: ICustomListSection) => (
<View style={styles.container}>
{title ? <CustomHeader {...{ title, translateTitle, statusColor }} /> : null}
{children}
</View>
);

export default CustomListSection;
47 changes: 47 additions & 0 deletions app/views/PushTroubleshootView/components/ListPercentage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'react';
import { StyleSheet, Text } from 'react-native';

import * as List from '../../../containers/List';
import { useTheme } from '../../../theme';
import sharedStyles from '../../Styles';

const styles = StyleSheet.create({
pickerText: {
...sharedStyles.textRegular,
fontSize: 16
}
});

const ListPercentage = ({
value = 0,
title,
testID,
onPress
}: {
title: string;
testID: string;
value: number;
onPress: () => void;
}) => {
const { colors } = useTheme();

const percentage = `${Math.floor(value)}%`;
let percentageTextColor = colors.pushConsumptionOnSuccess;
if (value > 70 && value < 90) {
percentageTextColor = colors.pushConsumptionOnWarning;
}
if (value >= 90) {
percentageTextColor = colors.pushConsumptionOnDanger;
}

return (
<List.Item
title={title}
testID={testID}
onPress={onPress}
right={() => <Text style={[styles.pickerText, { color: percentageTextColor }]}>{percentage}</Text>}
/>
);
};

export default ListPercentage;
Loading