From b186b6d23bd8243d9477c4fb07e529013788a7f9 Mon Sep 17 00:00:00 2001 From: feruz Date: Mon, 20 Jan 2020 19:53:40 +0200 Subject: [PATCH] fix account json bug, improve error messages --- .../UserInterfaceState.xcuserstate | Bin 30586 -> 30586 bytes src/config/locales/en-US.json | 1 + src/containers/pointsContainer.js | 2 +- src/containers/redeemContainer.js | 2 +- src/providers/steem/dsteem.js | 44 +++++++++--------- .../editor/container/editorContainer.js | 4 +- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/ios/eSteem.xcworkspace/xcuserdata/f.xcuserdatad/UserInterfaceState.xcuserstate b/ios/eSteem.xcworkspace/xcuserdata/f.xcuserdatad/UserInterfaceState.xcuserstate index d65ee9537393013107c44ad35f6225a5d82e2725..6168211491df559912103c619ace4589bd1dc6db 100644 GIT binary patch delta 31 ncmezMj`7z!#tm_4Y_GYdY`%YLa!Q&KtD&Wpfyw6XwD$r4|IiL$ delta 31 ncmezMj`7z!#tm_4Y_B#3FWQ?nIVDYr)xgZk$ar&i+Is;2{v!@7 diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index e87d2d105..6e9d301cb 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -280,6 +280,7 @@ "success_moved": "Moved to draft", "permission_denied": "Permission denied", "permission_text": "Please, go to phone Settings and change eSteem app permissions.", + "key_warning": "Check private key permission!", "success_rebloged": "Reblogged!", "already_rebloged": "You have already reblogged!", "success_favorite": "Favorite added!", diff --git a/src/containers/pointsContainer.js b/src/containers/pointsContainer.js index b3d95840d..1ee4d7a55 100644 --- a/src/containers/pointsContainer.js +++ b/src/containers/pointsContainer.js @@ -203,7 +203,7 @@ const PointsContainer = ({ .catch(error => { if (error) { setIsLoading(false); - dispatch(toastNotification(intl.formatMessage({ id: 'alert.fail' }))); + dispatch(toastNotification(intl.formatMessage({ id: 'alert.key_warning' }))); } }); }; diff --git a/src/containers/redeemContainer.js b/src/containers/redeemContainer.js index 9e326c3ef..59355a704 100644 --- a/src/containers/redeemContainer.js +++ b/src/containers/redeemContainer.js @@ -80,7 +80,7 @@ class RedeemContainer extends Component { }) .catch(error => { if (error) { - dispatch(toastNotification(intl.formatMessage({ id: 'alert.fail' }))); + dispatch(toastNotification(intl.formatMessage({ id: 'alert.key_warning' }))); } }); diff --git a/src/providers/steem/dsteem.js b/src/providers/steem/dsteem.js index 77a2a389d..3f49211f7 100644 --- a/src/providers/steem/dsteem.js +++ b/src/providers/steem/dsteem.js @@ -281,7 +281,7 @@ export const ignoreUser = async (currentAccount, pin, data) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; /** @@ -514,7 +514,7 @@ const _vote = async (currentAccount, pin, author, permlink, weight) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; /** @@ -562,7 +562,7 @@ export const transferToken = (currentAccount, pin, data) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const transferToSavings = (currentAccount, pin, data) => { @@ -596,7 +596,7 @@ export const transferToSavings = (currentAccount, pin, data) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const transferFromSavings = (currentAccount, pin, data) => { @@ -630,7 +630,7 @@ export const transferFromSavings = (currentAccount, pin, data) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const transferToVesting = (currentAccount, pin, data) => { @@ -662,7 +662,7 @@ export const transferToVesting = (currentAccount, pin, data) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const withdrawVesting = (currentAccount, pin, data) => { @@ -693,7 +693,7 @@ export const withdrawVesting = (currentAccount, pin, data) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const delegateVestingShares = (currentAccount, pin, data) => { @@ -725,7 +725,7 @@ export const delegateVestingShares = (currentAccount, pin, data) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const setWithdrawVestingRoute = (currentAccount, pin, data) => { @@ -758,7 +758,7 @@ export const setWithdrawVestingRoute = (currentAccount, pin, data) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const getWithdrawRoutes = account => @@ -805,7 +805,7 @@ export const followUser = async (currentAccount, pin, data) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const unfollowUser = async (currentAccount, pin, data) => { @@ -850,7 +850,7 @@ export const unfollowUser = async (currentAccount, pin, data) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const lookupAccounts = async username => { @@ -1014,7 +1014,7 @@ const _postContent = async ( }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; // Re-blog @@ -1061,7 +1061,7 @@ const _reblog = async (account, pinCode, author, permlink) => { return client.broadcast.json(json, privateKey); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const claimRewardBalance = (account, pinCode, rewardSteem, rewardSbd, rewardVests) => { @@ -1095,7 +1095,7 @@ export const claimRewardBalance = (account, pinCode, rewardSteem, rewardSbd, rew return client.broadcast.sendOperations(opArray, privateKey); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const transferPoint = (currentAccount, pinCode, data) => { @@ -1123,7 +1123,7 @@ export const transferPoint = (currentAccount, pinCode, data) => { return client.broadcast.json(op, privateKey); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const promote = (currentAccount, pinCode, duration, permlink, author) => { @@ -1149,7 +1149,7 @@ export const promote = (currentAccount, pinCode, duration, permlink, author) => return client.broadcast.json(json, privateKey); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const boost = (currentAccount, pinCode, point, permlink, author) => { @@ -1175,10 +1175,10 @@ export const boost = (currentAccount, pinCode, point, permlink, author) => { return client.broadcast.json(json, privateKey); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; -export const grantPostingPermission = async (params, pin, currentAccount) => { +export const grantPostingPermission = async (json, pin, currentAccount) => { const digitPinCode = getDigitPinCode(pin); const key = getActiveKey(get(currentAccount, 'local'), digitPinCode); @@ -1201,7 +1201,7 @@ export const grantPostingPermission = async (params, pin, currentAccount) => { account: get(currentAccount, 'name'), posting: newPosting, memo_key: get(currentAccount, 'memo_key'), - json_metadata: jsonStringify(params), + json_metadata: json, }; const opArray = [['account_update', _params]]; @@ -1220,7 +1220,7 @@ export const grantPostingPermission = async (params, pin, currentAccount) => { { account: get(currentAccount, 'name'), memo_key: get(currentAccount, 'memo_key'), - json_metadata: jsonStringify(params), + json_metadata: json, posting: newPosting, }, ], @@ -1242,7 +1242,7 @@ export const grantPostingPermission = async (params, pin, currentAccount) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; export const profileUpdate = async (params, pin, currentAccount) => { @@ -1298,7 +1298,7 @@ export const profileUpdate = async (params, pin, currentAccount) => { }); } - return Promise.reject(new Error('Private key permission issue!')); + return Promise.reject(new Error('Check private key permission!')); }; // HELPERS diff --git a/src/screens/editor/container/editorContainer.js b/src/screens/editor/container/editorContainer.js index 94e184430..83064957c 100644 --- a/src/screens/editor/container/editorContainer.js +++ b/src/screens/editor/container/editorContainer.js @@ -452,7 +452,7 @@ class EditorContainer extends Component { _handleDatePickerChange = async (datePickerValue, fields) => { const { currentAccount, pinCode, intl } = this.props; - const params = get(currentAccount, 'json_metadata', ''); + const json = get(currentAccount, 'json_metadata', ''); let hasPostingPerm = false; @@ -464,7 +464,7 @@ class EditorContainer extends Component { if (hasPostingPerm) { this._submitPost(fields, datePickerValue); } else { - await grantPostingPermission(params, pinCode, currentAccount) + await grantPostingPermission(json, pinCode, currentAccount) .then(() => { this._submitPost(fields, datePickerValue); })