diff --git a/ios/eSteem.xcworkspace/xcuserdata/mistik.xcuserdatad/UserInterfaceState.xcuserstate b/ios/eSteem.xcworkspace/xcuserdata/mistik.xcuserdatad/UserInterfaceState.xcuserstate
index bbe46063a..22fccb37a 100644
Binary files a/ios/eSteem.xcworkspace/xcuserdata/mistik.xcuserdatad/UserInterfaceState.xcuserstate and b/ios/eSteem.xcworkspace/xcuserdata/mistik.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json
index 8de6e69aa..4326b7502 100644
--- a/src/config/locales/en-US.json
+++ b/src/config/locales/en-US.json
@@ -69,6 +69,7 @@
"vote": "Vote",
"comment": "Comment",
"mention": "Mention",
+ "reblog": "Reblog",
"transfers": "Transfers"
},
"pincode": "PIN code",
diff --git a/src/realm/realm.js b/src/realm/realm.js
index a07d4018a..aca92970d 100644
--- a/src/realm/realm.js
+++ b/src/realm/realm.js
@@ -56,6 +56,7 @@ const settingsSchema = {
voteNotification: { type: 'bool', default: true },
commentNotification: { type: 'bool', default: true },
mentionNotification: { type: 'bool', default: true },
+ reblogNotification: { type: 'bool', default: true },
transfersNotification: { type: 'bool', default: true },
},
};
@@ -113,6 +114,7 @@ if (Array.from(settings).length <= 0) {
voteNotification: true,
commentNotification: true,
mentionNotification: true,
+ reblogNotification: true,
transfersNotification: true,
});
});
@@ -464,6 +466,9 @@ export const setNotificationSettings = ({ type, action }) => new Promise((resolv
case 'notification.mention':
settings[0].mentionNotification = action;
break;
+ case 'notification.reblog':
+ settings[0].reblogNotification = action;
+ break;
case 'notification.transfers':
settings[0].transfersNotification = action;
break;
diff --git a/src/redux/actions/applicationActions.js b/src/redux/actions/applicationActions.js
index d640cd6b7..1a212e90a 100644
--- a/src/redux/actions/applicationActions.js
+++ b/src/redux/actions/applicationActions.js
@@ -5,6 +5,7 @@ import {
CHANGE_COMMENT_NOTIFICATION,
CHANGE_FOLLOW_NOTIFICATION,
CHANGE_MENTION_NOTIFICATION,
+ CHANGE_REBLOG_NOTIFICATION,
CHANGE_TRANSFERS_NOTIFICATION,
CHANGE_VOTE_NOTIFICATION,
CLOSE_PIN_CODE_MODAL,
@@ -94,6 +95,12 @@ export const changeNotificationSettings = (payload) => {
type: CHANGE_MENTION_NOTIFICATION,
};
+ case 'notification.reblog':
+ return {
+ payload: payload.action,
+ type: CHANGE_REBLOG_NOTIFICATION,
+ };
+
case 'notification.transfers':
return {
payload: payload.action,
diff --git a/src/redux/constants/constants.js b/src/redux/constants/constants.js
index 56ed68f80..82a1396e2 100644
--- a/src/redux/constants/constants.js
+++ b/src/redux/constants/constants.js
@@ -26,6 +26,7 @@ export const CHANGE_FOLLOW_NOTIFICATION = 'CHANGE_FOLLOW_NOTIFICATION';
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_REBLOG_NOTIFICATION = 'CHANGE_REBLOG_NOTIFICATION';
export const CHANGE_TRANSFERS_NOTIFICATION = 'CHANGE_TRANSFERS_NOTIFICATION';
// Accounts
diff --git a/src/redux/reducers/applicationReducer.js b/src/redux/reducers/applicationReducer.js
index ef287f086..952635e70 100644
--- a/src/redux/reducers/applicationReducer.js
+++ b/src/redux/reducers/applicationReducer.js
@@ -3,6 +3,7 @@ import {
CHANGE_COMMENT_NOTIFICATION,
CHANGE_FOLLOW_NOTIFICATION,
CHANGE_MENTION_NOTIFICATION,
+ CHANGE_REBLOG_NOTIFICATION,
CHANGE_TRANSFERS_NOTIFICATION,
CHANGE_VOTE_NOTIFICATION,
CLOSE_PIN_CODE_MODAL,
@@ -42,6 +43,7 @@ const initialState = {
commentNotification: true,
followNotification: true,
mentionNotification: true,
+ reblogNotification: true,
transfersNotification: true,
voteNotification: true,
},
@@ -128,6 +130,13 @@ export default function (state = initialState, action) {
mentionNotification: action.payload,
},
});
+ case CHANGE_REBLOG_NOTIFICATION:
+ return Object.assign({}, state, {
+ notificationDetails: {
+ ...state.notificationDetails,
+ reblogNotification: action.payload,
+ },
+ });
case CHANGE_TRANSFERS_NOTIFICATION:
return Object.assign({}, state, {
notificationDetails: {
diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js
index d1244967c..99b1f2618 100644
--- a/src/screens/application/container/applicationContainer.js
+++ b/src/screens/application/container/applicationContainer.js
@@ -5,7 +5,6 @@ import {
import { connect } from 'react-redux';
import { addLocaleData } from 'react-intl';
import Config from 'react-native-config';
-import AppCenter from 'appcenter';
import { NavigationActions } from 'react-navigation';
import { bindActionCreators } from 'redux';
import Push from 'appcenter-push';
@@ -29,11 +28,9 @@ import AUTH_TYPE from '../../../constants/authType';
import {
getAuthStatus,
getExistUser,
- getPushTokenSaved,
getSettings,
getUserData,
removeUserData,
- setPushTokenSaved,
getUserDataWithUsername,
removePinCode,
setAuthStatus,
@@ -41,7 +38,6 @@ import {
setExistUser,
} from '../../../realm/realm';
import { getUser } from '../../../providers/steem/dsteem';
-import { setPushToken } from '../../../providers/esteem/esteem';
import { switchAccount } from '../../../providers/steem/auth';
// Actions
@@ -227,7 +223,6 @@ class ApplicationContainer extends Component {
dispatch(openPinCodeModal());
}
this._connectNotificationServer(accountData.name);
- this._setPushToken(accountData.name);
})
.catch((err) => {
Alert.alert(err);
@@ -254,6 +249,7 @@ class ApplicationContainer extends Component {
dispatch(changeNotificationSettings({ type: 'notification.vote', action: response.voteNotification }));
dispatch(changeNotificationSettings({ type: 'notification.comment', action: response.commentNotification }));
dispatch(changeNotificationSettings({ type: 'notification.mention', action: response.mentionNotification }));
+ dispatch(changeNotificationSettings({ type: 'notification.reblog', action: response.reblogNotification }));
dispatch(changeNotificationSettings({ type: 'notification.transfers', action: response.transfersNotification }));
Push.setEnabled(response.notification);
@@ -277,29 +273,6 @@ class ApplicationContainer extends Component {
};
};
- _setPushToken = async (username) => {
- const { notificationSettings } = this.props;
- const token = await AppCenter.getInstallId();
-
- getExistUser().then((isExistUser) => {
- if (isExistUser) {
- getPushTokenSaved().then((isPushTokenSaved) => {
- if (!isPushTokenSaved) {
- const data = {
- username,
- token,
- system: Platform.OS,
- allows_notify: Number(notificationSettings),
- };
- setPushToken(data).then(() => {
- setPushTokenSaved(true);
- });
- }
- });
- }
- });
- };
-
_logout = async () => {
const { otherAccounts, currentAccount, dispatch } = this.props;
diff --git a/src/screens/login/container/loginContainer.js b/src/screens/login/container/loginContainer.js
index 6923c3bb3..d3a6745be 100644
--- a/src/screens/login/container/loginContainer.js
+++ b/src/screens/login/container/loginContainer.js
@@ -1,7 +1,8 @@
import React, { PureComponent } from 'react';
-import { Alert, Linking } from 'react-native';
+import { Alert, Linking, Platform } from 'react-native';
import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
+import AppCenter from 'appcenter';
// Services and Actions
import { login } from '../../../providers/steem/auth';
@@ -13,6 +14,8 @@ import {
updateCurrentAccount,
} from '../../../redux/actions/accountAction';
import { login as loginAction, openPinCodeModal } from '../../../redux/actions/applicationActions';
+import { setPushTokenSaved } from '../../../realm/realm';
+import { setPushToken } from '../../../providers/esteem/esteem';
// Middleware
@@ -57,6 +60,7 @@ class LoginContainer extends PureComponent {
setPinCodeState({ navigateTo: ROUTES.DRAWER.MAIN });
dispatch(loginAction(true));
userActivity(result.name, 20);
+ this._setPushToken(result.name);
}
})
.catch((err) => {
@@ -71,6 +75,39 @@ class LoginContainer extends PureComponent {
});
};
+ _setPushToken = async (username) => {
+ const { notificationSettings, notificationDetails } = this.props;
+ const notifyTypesConst = {
+ vote: 1,
+ mention: 2,
+ follow: 3,
+ comment: 4,
+ reblog: 5,
+ transfers: 6,
+ };
+ const notifyTypes = [];
+ const token = await AppCenter.getInstallId();
+
+ Object.keys(notificationDetails).map((item) => {
+ const notificationType = item.replace('Notification', '');
+
+ if (notificationDetails[item]) {
+ notifyTypes.push(notifyTypesConst[notificationType]);
+ }
+ });
+
+ const data = {
+ username,
+ token,
+ system: Platform.OS,
+ allows_notify: Number(notificationSettings),
+ notify_types: notifyTypes,
+ };
+ setPushToken(data).then(() => {
+ setPushTokenSaved(true);
+ });
+ };
+
_getAccountsWithUsername = async (username) => {
const validUsers = await lookupAccounts(username);
return validUsers;
@@ -98,6 +135,8 @@ class LoginContainer extends PureComponent {
const mapStateToProps = state => ({
account: state.accounts,
+ notificationDetails: state.application.notificationDetails,
+ notificationSettings: state.application.isNotificationOpen,
});
export default injectIntl(connect(mapStateToProps)(LoginContainer));
diff --git a/src/screens/settings/container/settingsContainer.js b/src/screens/settings/container/settingsContainer.js
index c8bbfd42d..1b574284e 100644
--- a/src/screens/settings/container/settingsContainer.js
+++ b/src/screens/settings/container/settingsContainer.js
@@ -148,6 +148,7 @@ class SettingsContainer extends Component {
case 'notification.vote':
case 'notification.comment':
case 'notification.mention':
+ case 'notification.reblog':
case 'notification.transfers':
this._handleNotification(action, actionType);
break;
@@ -274,6 +275,7 @@ const mapStateToProps = state => ({
commentNotification: state.application.notificationDetails.commentNotification,
followNotification: state.application.notificationDetails.followNotification,
mentionNotification: state.application.notificationDetails.mentionNotification,
+ reblogNotification: state.application.notificationDetails.reblogNotification,
transfersNotification: state.application.notificationDetails.transfersNotification,
voteNotification: state.application.notificationDetails.voteNotification,
});
diff --git a/src/screens/settings/screen/settingsScreen.js b/src/screens/settings/screen/settingsScreen.js
index 37afb7174..a0636461c 100644
--- a/src/screens/settings/screen/settingsScreen.js
+++ b/src/screens/settings/screen/settingsScreen.js
@@ -48,6 +48,7 @@ class SettingsScreen extends PureComponent {
commentNotification,
followNotification,
mentionNotification,
+ reblogNotification,
transfersNotification,
voteNotification,
} = this.props;
@@ -134,73 +135,84 @@ class SettingsScreen extends PureComponent {
/>
)}
-
-
+
+)}
+ noBorder
+ fitContent
+ locked
+ isExpanded={isNotificationSettingsOpen}
+ expanded={isNotificationMenuOpen}
+ >
-)}
- noBorder
- fitContent
- locked
- isExpanded={isNotificationSettingsOpen}
- expanded={isNotificationMenuOpen}
- >
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ )}
);