fetching ecency user data with current account

This commit is contained in:
noumantahir 2022-02-25 00:12:06 +05:00
parent 8329160e9b
commit 0003694d55
3 changed files with 13 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import { useIntl } from 'react-intl';
import { useAppSelector } from '../../../hooks';
import { getUnreadNotificationCount } from '../../../providers/ecency/ecency';
import { decryptKey } from '../../../utils/crypto';
import { getUser as getEcencyUser} from '../../../providers/ecency/ePoint';
const AccountsBottomSheetContainer = ({ navigation }) => {
const intl = useIntl();
@ -106,6 +107,7 @@ const AccountsBottomSheetContainer = ({ navigation }) => {
decryptKey(encryptedAccessToken, getDigitPinCode(pinHash))
);
_currentAccount.mutes = await getMutes(_currentAccount.username);
_currentAccount.ecencyUserData = await getEcencyUser(_currentAccount.username);
dispatch(updateCurrentAccount(_currentAccount));
}

View File

@ -41,6 +41,7 @@ import {
setLastUpdateCheck,
} from '../../../realm/realm';
import { getUser, getPost, getDigitPinCode, getMutes } from '../../../providers/hive/dhive';
import { getUser as getEcencyUser } from '../../../providers/ecency/ePoint';
import {
migrateToMasterKeyWithAccessToken,
refreshSCToken,
@ -51,6 +52,7 @@ import {
markActivityAsRead,
markNotifications,
getUnreadNotificationCount,
getLatestQuotes,
} from '../../../providers/ecency/ecency';
import { fetchLatestAppVersion } from '../../../providers/github/github';
import { navigate } from '../../../navigation/service';
@ -95,6 +97,7 @@ import {
updateActiveBottomTab,
} from '../../../redux/actions/uiAction';
import { setFeedPosts, setInitPosts } from '../../../redux/actions/postsAction';
import { fetchCoinQuotes, resetWalletData } from '../../../redux/actions/walletActions';
import { encryptKey } from '../../../utils/crypto';
@ -139,6 +142,8 @@ class ApplicationContainer extends Component {
const { appVersion } = VersionNumber;
const { dispatch, isAnalytics } = this.props;
dispatch(resetWalletData());
this._setNetworkListener();
Linking.addEventListener('url', this._handleOpenURL);
@ -619,6 +624,7 @@ class ApplicationContainer extends Component {
_refreshGlobalProps = () => {
const { actions } = this.props;
actions.fetchGlobalProperties();
actions.fetchCoinQuotes();
};
_getUserDataFromRealm = async () => {
@ -759,6 +765,7 @@ class ApplicationContainer extends Component {
accountData.unread_activity_count = await getUnreadNotificationCount();
accountData.mutes = await getMutes(realmObject.username);
accountData.ecencyUserData = await getEcencyUser(realmObject.username);
dispatch(updateCurrentAccount(accountData));
this._connectNotificationServer(accountData.name);
@ -941,6 +948,7 @@ class ApplicationContainer extends Component {
_currentAccount.unread_activity_count = await getUnreadNotificationCount();
_currentAccount.mutes = await getMutes(_currentAccount.username);
_currentAccount.ecencyUserData = await getEcencyUser(_currentAccount.username);
dispatch(updateCurrentAccount(_currentAccount));
};
@ -1068,6 +1076,7 @@ export default connect(
...bindActionCreators(
{
fetchGlobalProperties,
fetchCoinQuotes,
},
dispatch,
),

View File

@ -36,6 +36,7 @@ import {
} from '../../../realm/realm';
import { updateCurrentAccount, removeOtherAccount } from '../../../redux/actions/accountAction';
import { getDigitPinCode, getMutes, getUser } from '../../../providers/hive/dhive';
import { getUser as getEcencyUser } from '../../../providers/ecency/ePoint';
// Utils
import { encryptKey, decryptKey } from '../../../utils/crypto';
@ -319,6 +320,7 @@ class PinCodeContainer extends Component {
//get unread notifications
_currentAccount.unread_activity_count = await getUnreadNotificationCount();
_currentAccount.mutes = await getMutes(_currentAccount.username);
_currentAccount.ecencyUserData = await getEcencyUser(_currentAccount.username);
dispatch(updateCurrentAccount({ ..._currentAccount }));
dispatch(closePinCodeModal());
}