added missing pieces required to support bookmark notifications

This commit is contained in:
noumantahir 2022-11-04 19:26:58 +05:00
parent 757bfcbb17
commit 119f537709
7 changed files with 27 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import {
CHANGE_FOLLOW_NOTIFICATION,
CHANGE_MENTION_NOTIFICATION,
CHANGE_FAVORITE_NOTIFICATION,
CHANGE_BOOKMARK_NOTIFICATION,
CHANGE_REBLOG_NOTIFICATION,
CHANGE_TRANSFERS_NOTIFICATION,
CHANGE_ALL_NOTIFICATION_SETTINGS,
@ -110,6 +111,12 @@ export const changeNotificationSettings = (payload) => {
type: CHANGE_FAVORITE_NOTIFICATION,
};
case 'notification.bookmark':
return {
payload: payload.action,
type: CHANGE_BOOKMARK_NOTIFICATION
}
case 'notification.reblog':
return {
payload: payload.action,

View File

@ -28,6 +28,7 @@ export const CHANGE_VOTE_NOTIFICATION = 'CHANGE_VOTE_NOTIFICATION';
export const CHANGE_COMMENT_NOTIFICATION = 'CHANGE_COMMENT_NOTIFICATION';
export const CHANGE_MENTION_NOTIFICATION = 'CHANGE_MENTION_NOTIFICATION';
export const CHANGE_FAVORITE_NOTIFICATION = 'CHANGE_FAVORITE_NOTIFICATION';
export const CHANGE_BOOKMARK_NOTIFICATION = 'CHANGE_BOOKMARK_NOTIFICATION';
export const CHANGE_REBLOG_NOTIFICATION = 'CHANGE_REBLOG_NOTIFICATION';
export const CHANGE_TRANSFERS_NOTIFICATION = 'CHANGE_TRANSFERS_NOTIFICATION';
export const CHANGE_ALL_NOTIFICATION_SETTINGS = 'CHANGE_ALL_NOTIFICATION_SETTINGS';

View File

@ -3,6 +3,7 @@ import {
CHANGE_FOLLOW_NOTIFICATION,
CHANGE_MENTION_NOTIFICATION,
CHANGE_FAVORITE_NOTIFICATION,
CHANGE_BOOKMARK_NOTIFICATION,
CHANGE_REBLOG_NOTIFICATION,
CHANGE_TRANSFERS_NOTIFICATION,
CHANGE_VOTE_NOTIFICATION,
@ -186,6 +187,13 @@ export default function (state = initialState, action): State {
favoriteNotification: action.payload,
},
});
case CHANGE_BOOKMARK_NOTIFICATION:
return Object.assign({}, state, {
notificationDetails: {
...state.notificationDetails,
bookmarkNotification: action.payload,
},
});
case CHANGE_REBLOG_NOTIFICATION:
return Object.assign({}, state, {
notificationDetails: {

View File

@ -43,8 +43,8 @@ const persistConfig = {
key: 'root',
// Storage Method (React Native)
storage: AsyncStorage,
version: 1, // New version 0, default or previous version -1, versions are useful migrations
// Blacklist (Don't Save Specific Reducers)
version: 2, // New version 0, default or previous version -1, versions are useful migrations
// // Blacklist (Don't Save Specific Reducers)
blacklist: ['communities', 'user', 'ui'],
timeout: 0,
transforms: [transformCacheVoteMap, transformWalkthroughMap],

View File

@ -776,7 +776,7 @@ class ApplicationContainer extends Component {
}
});
} else {
notify_types = [1, 2, 3, 4, 5, 6];
notify_types = [1, 2, 3, 4, 5, 6, 13, 15];
}
messaging()

View File

@ -216,6 +216,8 @@ class LoginContainer extends PureComponent {
comment: 4,
reblog: 5,
transfers: 6,
favorite: 13,
bookmark: 15,
};
const notifyTypes = [];
@ -236,9 +238,11 @@ class LoginContainer extends PureComponent {
system: `fcm-${Platform.OS}`,
allows_notify: Number(notificationSettings),
notify_types: notifyTypes,
};
setPushToken(data).then(() => {
setPushTokenSaved(true);
});
});
};

View File

@ -173,6 +173,10 @@ const reduxMigrations = {
state.application.notificationDetails.favoriteNotification = true;
return state;
},
2: (state) => {
state.application.notificationDetails.bookmarkNotification = true;
return state;
},
};
export default {