Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
25 changes: 10 additions & 15 deletions routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,48 +263,44 @@ const MainTabNavigator = TabNavigator(
Home: {
screen: HomeStackNavigator,
navigationOptions: {
tabBarIcon: ({ tintColor }) => (
tabBarIcon: ({ tintColor }) =>
<Icon
containerStyle={{ justifyContent: 'center', alignItems: 'center' }}
color={tintColor}
name="home"
size={33}
/>
),
/>,
},
},
Notifications: {
screen: NotificationsStackNavigator,
navigationOptions: {
tabBarIcon: ({ tintColor }) => (
<NotificationIcon iconColor={tintColor} />
),
tabBarIcon: ({ tintColor }) =>
<NotificationIcon iconColor={tintColor} />,
},
},
Search: {
screen: SearchStackNavigator,
navigationOptions: {
tabBarIcon: ({ tintColor }) => (
tabBarIcon: ({ tintColor }) =>
<Icon
containerStyle={{ justifyContent: 'center', alignItems: 'center' }}
color={tintColor}
name="search"
size={33}
/>
),
/>,
},
},
MyProfile: {
screen: MyProfileStackNavigator,
navigationOptions: {
tabBarIcon: ({ tintColor }) => (
tabBarIcon: ({ tintColor }) =>
<Icon
containerStyle={{ justifyContent: 'center', alignItems: 'center' }}
color={tintColor}
name="person"
size={33}
/>
),
/>,
},
},
},
Expand All @@ -319,7 +315,7 @@ const MainTabNavigator = TabNavigator(
backgroundColor: colors.alabaster,
},
},
tabBarComponent: ({ jumpToIndex, ...props }) => (
tabBarComponent: ({ jumpToIndex, ...props }) =>
<TabBarBottom
{...props}
jumpToIndex={index => {
Expand All @@ -345,8 +341,7 @@ const MainTabNavigator = TabNavigator(
jumpToIndex(index);
}
}}
/>
),
/>,
}
);

Expand Down
3 changes: 3 additions & 0 deletions src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ export const fetchMarkNotificationAsRead = (notificationID, accessToken) =>
export const fetchMarkRepoNotificationAsRead = (repoFullName, accessToken) =>
v3.put(`/repos/${repoFullName}/notifications`, accessToken);

export const fetchMarkAllNotificationsAsRead = accessToken =>
v3.put('/notifications', accessToken);

export const fetchChangeStarStatusRepo = (owner, repo, starred, accessToken) =>
v3[starred ? 'delete' : 'put'](`/user/starred/${owner}/${repo}`, accessToken);

Expand Down
1 change: 1 addition & 0 deletions src/locale/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export const en = {
allButton: 'All',
retrievingMessage: 'Retrieving notifications',
noneMessage: "You don't have any notifications of this type",
markAllAsRead: 'Mark all as read',
},
},
search: {
Expand Down
1 change: 1 addition & 0 deletions src/locale/languages/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export const fr = {
allButton: 'Tous',
retrievingMessage: 'Récupération des notifications',
noneMessage: "Vous n'avez aucune notification de ce type",
markAllAsRead: 'Mark all as read',
},
},
search: {
Expand Down
1 change: 1 addition & 0 deletions src/locale/languages/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export const nl = {
allButton: 'Alles',
retrievingMessage: 'Notificaties ophalen',
noneMessage: 'Je hebt geen notificaties met dit type',
markAllAsRead: 'Mark all as read',
},
},
search: {
Expand Down
1 change: 1 addition & 0 deletions src/locale/languages/pt-br.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const ptBr = {
allButton: 'Todas',
retrievingMessage: 'Buscando notificações',
noneMessage: 'Você não tem notificações deste tipo',
markAllAsRead: 'Mark all as read',
},
},
search: {
Expand Down
1 change: 1 addition & 0 deletions src/locale/languages/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const ru = {
allButton: 'Все',
retrievingMessage: 'Получение уведомлений',
noneMessage: 'У вас нет уведомлений по этому типу',
markAllAsRead: 'Отметить все как прочитанные',
},
},
search: {
Expand Down
1 change: 1 addition & 0 deletions src/locale/languages/tr.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export const tr = {
allButton: 'Tümü',
retrievingMessage: 'Bildirim alınıyor',
noneMessage: 'Bu türde hiçbir bildirime sahip değilsiniz',
markAllAsRead: 'Mark all as read',
},
},
search: {
Expand Down
23 changes: 23 additions & 0 deletions src/notifications/notifications.action.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
fetchMarkRepoNotificationAsRead,
fetchNotificationsCount,
fetchRepoNotificationsCount,
fetchMarkAllNotificationsAsRead,
} from 'api';
import {
GET_UNREAD_NOTIFICATIONS,
Expand All @@ -12,6 +13,7 @@ import {
MARK_NOTIFICATION_AS_READ,
MARK_REPO_AS_READ,
GET_NOTIFICATIONS_COUNT,
MARK_ALL_NOTIFICATIONS_AS_READ,
} from './notifications.type';

export const getUnreadNotifications = () => {
Expand Down Expand Up @@ -153,3 +155,24 @@ export const getNotificationsCount = () => {
});
};
};

export const markAllNotificationsAsRead = () => {
return (dispatch, getState) => {
const accessToken = getState().auth.accessToken;

dispatch({ type: MARK_ALL_NOTIFICATIONS_AS_READ.PENDING });

fetchMarkAllNotificationsAsRead(accessToken)
.then(() => {
dispatch({
type: MARK_ALL_NOTIFICATIONS_AS_READ.SUCCESS,
});
})
.catch(error => {
dispatch({
type: MARK_ALL_NOTIFICATIONS_AS_READ.ERROR,
payload: error,
});
});
};
};
18 changes: 18 additions & 0 deletions src/notifications/notifications.reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
MARK_NOTIFICATION_AS_READ,
MARK_REPO_AS_READ,
GET_NOTIFICATIONS_COUNT,
MARK_ALL_NOTIFICATIONS_AS_READ,
} from './notifications.type';

const initialState = {
Expand All @@ -16,6 +17,7 @@ const initialState = {
isPendingAll: false,
isPendingMarkNotificationAsRead: false,
isPendingRepoMarkAsRead: false,
isPendingMarkAllNotificationsAsRead: false,
error: '',
notificationsCount: null,
};
Expand Down Expand Up @@ -150,6 +152,22 @@ export const notificationsReducer = (state = initialState, action = {}) => {
...state,
error: action.payload,
};
case MARK_ALL_NOTIFICATIONS_AS_READ.PENDING:
return {
...state,
isPendingMarkAllNotificationsAsRead: true,
};
case MARK_ALL_NOTIFICATIONS_AS_READ.SUCCESS:
return {
...state,
isPendingMarkAllNotificationsAsRead: false,
};
case MARK_ALL_NOTIFICATIONS_AS_READ.ERROR:
return {
...state,
error: action.payload,
isPendingMarkAllNotificationsAsRead: false,
};
default:
return state;
}
Expand Down
3 changes: 3 additions & 0 deletions src/notifications/notifications.type.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ export const MARK_REPO_AS_READ = createActionSet('MARK_REPO_AS_READ');
export const GET_NOTIFICATIONS_COUNT = createActionSet(
'GET_NOTIFICATIONS_COUNT'
);
export const MARK_ALL_NOTIFICATIONS_AS_READ = createActionSet(
'MARK_ALL_NOTIFICATIONS_AS_READ'
);
Loading