mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-19 11:21:41 +03:00
update notifications map on unread activity count increase
This commit is contained in:
parent
b4153f0ff1
commit
d715967bdd
@ -181,14 +181,25 @@ class NotificationContainer extends Component {
|
||||
};
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||
const { selectedFilter } = this.state;
|
||||
const { selectedFilter, notificationsMap } = this.state;
|
||||
const { currentAccount } = this.props;
|
||||
if (
|
||||
currentAccount &&
|
||||
nextProps.currentAccount &&
|
||||
nextProps.currentAccount.name !== currentAccount.name
|
||||
) {
|
||||
this.setState({ endOfNotification: false }, () => this._getActivities(selectedFilter));
|
||||
if (currentAccount && nextProps.currentAccount) {
|
||||
if (nextProps.currentAccount.name !== currentAccount.name) {
|
||||
this.setState(
|
||||
{
|
||||
endOfNotification: false,
|
||||
notificationsMap: new Map(),
|
||||
},
|
||||
() => this._getActivities(selectedFilter),
|
||||
);
|
||||
} else if (
|
||||
nextProps.currentAccount.unread_activity_count > currentAccount.unread_activity_count
|
||||
) {
|
||||
notificationsMap.forEach((value, key) => {
|
||||
console.log('fetching new activities for ', key);
|
||||
this._getActivities(key, false, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user