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) {
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
const { selectedFilter } = this.state;
|
const { selectedFilter, notificationsMap } = this.state;
|
||||||
const { currentAccount } = this.props;
|
const { currentAccount } = this.props;
|
||||||
if (
|
if (currentAccount && nextProps.currentAccount) {
|
||||||
currentAccount &&
|
if (nextProps.currentAccount.name !== currentAccount.name) {
|
||||||
nextProps.currentAccount &&
|
this.setState(
|
||||||
nextProps.currentAccount.name !== currentAccount.name
|
{
|
||||||
) {
|
endOfNotification: false,
|
||||||
this.setState({ endOfNotification: false }, () => this._getActivities(selectedFilter));
|
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