Merge pull request #1895 from ecency/nt/tweaks

Nt/tweaks
This commit is contained in:
Feruz M 2021-04-05 16:13:32 +03:00 committed by GitHub
commit 8fb6cc975e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 4 deletions

View File

@ -189,8 +189,6 @@ class NotificationView extends PureComponent {
_notifications && _notifications.length > 0 ? (
<FlatList
data={_notifications}
refreshing={isNotificationRefreshing}
onRefresh={() => getActivities()}
keyExtractor={(item) => item.title}
onEndReached={() => getActivities(null, selectedFilter, true)}
ListFooterComponent={this._renderFooterLoading}
@ -199,6 +197,7 @@ class NotificationView extends PureComponent {
refreshControl={
<RefreshControl
refreshing={isNotificationRefreshing}
onRefresh={() => getActivities()}
progressBackgroundColor="#357CE6"
tintColor={!isDarkTheme ? '#357ce6' : '#96c0ff'}
titleColor="#fff"

View File

@ -75,7 +75,11 @@ import {
setPinCode as savePinCode,
isRenderRequired,
} from '../../../redux/actions/applicationActions';
import { hideActionModal, updateActiveBottomTab } from '../../../redux/actions/uiAction';
import {
hideActionModal,
toastNotification,
updateActiveBottomTab,
} from '../../../redux/actions/uiAction';
import { encryptKey } from '../../../utils/crypto';
@ -457,6 +461,15 @@ class ApplicationContainer extends Component {
}
};
_showNotificationToast = (remoteMessage) => {
const { dispatch } = this.props;
if (remoteMessage && remoteMessage.notification) {
const { title } = remoteMessage.notification;
dispatch(toastNotification(title));
}
};
_createPushListener = () => {
(async () => await messaging().requestPermission())();
@ -464,6 +477,7 @@ class ApplicationContainer extends Component {
PushNotification.cancelAllLocalNotifications();
firebaseOnMessageListener = messaging().onMessage((remoteMessage) => {
this._showNotificationToast(remoteMessage);
this._pushNavigate(remoteMessage);
});

View File

@ -41,7 +41,7 @@ class NotificationContainer extends Component {
const since = loadMore ? lastNotificationId : null;
const { username } = this.props;
if (!endOfNotification) {
if (!endOfNotification || !loadMore) {
this.setState({ isNotificationRefreshing: true });
getActivities({ user: user || username, type, since })
.then((res) => {