RN-344 open push notifications faster (#899)
This commit is contained in:
parent
e0cfefcdff
commit
19502f9aaa
5 changed files with 23 additions and 30 deletions
|
|
@ -39,7 +39,7 @@ export function loadChannelsIfNecessary(teamId) {
|
|||
export function loadProfilesAndTeamMembersForDMSidebar(teamId) {
|
||||
return async (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const {currentUserId} = state.entities.users;
|
||||
const {currentUserId, profilesInChannel} = state.entities.users;
|
||||
const {channels, myMembers} = state.entities.channels;
|
||||
const {myPreferences} = state.entities.preferences;
|
||||
const {membersInTeam} = state.entities.teams;
|
||||
|
|
@ -96,7 +96,8 @@ export function loadProfilesAndTeamMembersForDMSidebar(teamId) {
|
|||
}
|
||||
|
||||
for (const [key, pref] of gmPrefs) {
|
||||
if (pref.value === 'true') {
|
||||
//only load the profiles in channels if we don't already have them
|
||||
if (pref.value === 'true' && !profilesInChannel[key]) {
|
||||
loadProfilesForChannels.push(key);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,13 @@
|
|||
import {ViewTypes} from 'app/constants';
|
||||
import {
|
||||
handleSelectChannel,
|
||||
loadChannelsIfNecessary,
|
||||
loadProfilesAndTeamMembersForDMSidebar,
|
||||
setChannelDisplayName
|
||||
} from 'app/actions/views/channel';
|
||||
import {handleTeamChange, selectFirstAvailableTeam} from 'app/actions/views/select_team';
|
||||
|
||||
import {General} from 'mattermost-redux/constants';
|
||||
import {getClientConfig, getLicenseConfig} from 'mattermost-redux/actions/general';
|
||||
import {markChannelAsRead, viewChannel} from 'mattermost-redux/actions/channels';
|
||||
import {getChannelAndMyMember, markChannelAsRead, viewChannel} from 'mattermost-redux/actions/channels';
|
||||
|
||||
export function loadConfigAndLicense() {
|
||||
return async (dispatch, getState) => {
|
||||
|
|
@ -42,28 +40,30 @@ export function goToNotification(notification) {
|
|||
const state = getState();
|
||||
const {data} = notification;
|
||||
const {currentTeamId, teams} = state.entities.teams;
|
||||
const {currentChannelId} = state.entities.channels;
|
||||
const {channels, currentChannelId, myMembers} = state.entities.channels;
|
||||
const channelId = data.channel_id;
|
||||
|
||||
// if the notification does not have a team id is because its from a DM or GM
|
||||
let teamId = data.team_id || currentTeamId;
|
||||
const teamId = data.team_id || currentTeamId;
|
||||
|
||||
dispatch(setChannelDisplayName(''));
|
||||
|
||||
if (teamId) {
|
||||
if (teamId && teamId !== currentTeamId) {
|
||||
handleTeamChange(teams[teamId], false)(dispatch, getState);
|
||||
await loadChannelsIfNecessary(teamId)(dispatch, getState);
|
||||
} else {
|
||||
} else if (!teamId) {
|
||||
await selectFirstAvailableTeam()(dispatch, getState);
|
||||
teamId = state.entities.team.currentTeamId;
|
||||
}
|
||||
|
||||
viewChannel(channelId)(dispatch, getState);
|
||||
loadProfilesAndTeamMembersForDMSidebar(teamId)(dispatch, getState);
|
||||
if (!channels[channelId] || !myMembers[channelId]) {
|
||||
getChannelAndMyMember(channelId)(dispatch, getState);
|
||||
}
|
||||
|
||||
if (channelId !== currentChannelId) {
|
||||
handleSelectChannel(channelId)(dispatch, getState);
|
||||
}
|
||||
|
||||
viewChannel(channelId)(dispatch, getState);
|
||||
|
||||
markChannelAsRead(channelId, currentChannelId)(dispatch, getState);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,18 +99,10 @@ export default class Root extends PureComponent {
|
|||
});
|
||||
};
|
||||
|
||||
handleNotificationTapped = () => {
|
||||
const {navigator, theme} = this.props;
|
||||
|
||||
navigator.resetTo({
|
||||
screen: 'Channel',
|
||||
animated: true,
|
||||
navigatorStyle: {
|
||||
navBarHidden: true,
|
||||
statusBarHidden: false,
|
||||
statusBarHideWithNavBar: false,
|
||||
screenBackgroundColor: theme.centerChannelBg
|
||||
}
|
||||
handleNotificationTapped = async () => {
|
||||
const {navigator} = this.props;
|
||||
navigator.popToRoot({
|
||||
animated: false
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
"react-native-keyboard-aware-scroll-view": "0.2.8",
|
||||
"react-native-linear-gradient": "2.0.0",
|
||||
"react-native-local-auth": "enahum/react-native-local-auth.git",
|
||||
"react-native-navigation": "1.1.131",
|
||||
"react-native-navigation": "1.1.216",
|
||||
"react-native-notifications": "enahum/react-native-notifications.git",
|
||||
"react-native-orientation": "enahum/react-native-orientation.git",
|
||||
"react-native-passcode-status": "1.1.0",
|
||||
|
|
|
|||
|
|
@ -3713,7 +3713,7 @@ makeerror@1.0.x:
|
|||
|
||||
mattermost-redux@mattermost/mattermost-redux#master:
|
||||
version "0.0.1"
|
||||
resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/1afaf513717108b609c4dc677cf49d474624e0ca"
|
||||
resolved "https://codeload.github.com/mattermost/mattermost-redux/tar.gz/51f9ab2b2e163bbca75213fa44b2a3a96f916c9f"
|
||||
dependencies:
|
||||
deep-equal "1.0.1"
|
||||
harmony-reflect "1.5.1"
|
||||
|
|
@ -4645,9 +4645,9 @@ react-native-mock@^0.2.7:
|
|||
react-timer-mixin "^0.13.3"
|
||||
warning "^2.1.0"
|
||||
|
||||
react-native-navigation@1.1.131:
|
||||
version "1.1.131"
|
||||
resolved "https://registry.yarnpkg.com/react-native-navigation/-/react-native-navigation-1.1.131.tgz#79b0583def2310e93305048f7149ad1970666f51"
|
||||
react-native-navigation@1.1.216:
|
||||
version "1.1.216"
|
||||
resolved "https://registry.yarnpkg.com/react-native-navigation/-/react-native-navigation-1.1.216.tgz#aa0771fdfa8e37caf57f8470067e807b0cbc2de1"
|
||||
dependencies:
|
||||
lodash "4.x.x"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue