Merge pull request #1220 from esteemapp/bugfix/wrong-time

Changed error message for wrong time
This commit is contained in:
uğur erdal 2019-10-22 21:11:17 +03:00 committed by GitHub
commit 9130230d22
6 changed files with 54 additions and 20 deletions

View File

@ -37,7 +37,7 @@
"crypto-js": "^3.1.9-1",
"currency-symbol-map": "^4.0.4",
"diff-match-patch": "^1.0.4",
"dsteem": "https://github.com/esteemapp/dsteem#expire",
"dsteem": "esteemapp/dsteem",
"intl": "^1.2.5",
"jsc-android": "^236355.1.1",
"lodash": "^4.17.13",

View File

@ -357,5 +357,12 @@
},
"reblog": {
"title": "Reblog Info"
},
"dsteem": {
"date_error": {
"device_time": "Your device time;",
"current_time": "Current time;",
"information": "We noticed that your device has incorrect date or time. Please fix Date & Time or Set Automatically and try again."
}
}
}

View File

@ -16,6 +16,7 @@ import { getReputation } from '../../utils/reputation';
import parseToken from '../../utils/parseToken';
import filterNsfwPost from '../../utils/filterNsfwPost';
import { jsonStringify } from '../../utils/jsonUtils';
import { getDsteemDateErrorMessage } from '../../utils/dsteemUtils';
// Constant
import AUTH_TYPE from '../../constants/authType';
@ -494,8 +495,7 @@ const _vote = async (currentAccount, pin, author, permlink, weight) => {
})
.catch(err => {
if (get(err, 'jse_info.code') === 4030100) {
err.message =
'We noticed that your device has incorrect date or time. Please fix Date & Time or Set Automatically and try again.';
err.message = getDsteemDateErrorMessage(err);
}
reject(err);
});
@ -995,8 +995,7 @@ const _postContent = async (
})
.catch(error => {
if (get(error, 'jse_info.code') === 4030100) {
error.message =
'We noticed that your device has incorrect date or time. Please fix Date & Time or Set Automatically and try again.';
error.message = getDsteemDateErrorMessage(error);
}
reject(error);
});
@ -1213,8 +1212,7 @@ export const profileUpdate = async (params, pin, currentAccount) => {
})
.catch(error => {
if (get(error, 'jse_info.code') === 4030100) {
error.message =
'We noticed that your device has incorrect date or time. Please fix Date & Time or Set Automatically and try again.';
error.message = getDsteemDateErrorMessage(error);
}
reject(error);
});

22
src/utils/createIntl.js Normal file
View File

@ -0,0 +1,22 @@
import { createIntl, createIntlCache } from 'react-intl';
import { flattenMessages } from './flattenMessages';
import messages from '../config/locales';
const _createIntl = () => {
const store = require('../redux/store/store');
const state = store.store.getState();
const cache = createIntlCache();
const locale = state.application.language;
const intl = createIntl(
{
locale,
messages: flattenMessages(messages[locale]),
},
cache,
);
return intl;
};
export default _createIntl;

12
src/utils/dsteemUtils.js Normal file
View File

@ -0,0 +1,12 @@
import createIntl from './createIntl';
export const getDsteemDateErrorMessage = error => {
const intl = createIntl();
const trxTime = error.jse_info.stack[0].data['trx.expiration'];
const now = error.jse_info.stack[0].data.now;
return `${intl.formatMessage({
id: 'dsteem.date_error.device_time',
})} ${trxTime} \n ${intl.formatMessage({
id: 'dsteem.date_error.current_time',
})} ${now} \n \n ${intl.formatMessage({ id: 'dsteem.date_error.information' })}`;
};

View File

@ -3314,17 +3314,17 @@ drbg.js@^1.0.1:
create-hash "^1.1.2"
create-hmac "^1.1.4"
"dsteem@https://github.com/esteemapp/dsteem#expire":
version "0.10.1"
resolved "https://github.com/esteemapp/dsteem#4b666eaca196479538681d251865738553d76702"
dsteem@esteemapp/dsteem:
version "0.11.3"
resolved "https://codeload.github.com/esteemapp/dsteem/tar.gz/cf1ded7f96468361ada5195a710350867a306adb"
dependencies:
bs58 "^4.0.1"
bytebuffer "^5.0.1"
core-js "^2.5.0"
node-fetch "^2.1.2"
secp256k1 "^3.3.1"
node-fetch "^2.3.0"
secp256k1 "^3.5.2"
verror "^1.10.0"
whatwg-fetch "^2.0.3"
whatwg-fetch "^3.0.0"
ecc-jsbn@~0.1.1:
version "0.1.2"
@ -6657,7 +6657,7 @@ nice-try@^1.0.4:
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
node-fetch@2.6.0, node-fetch@^2.1.2, node-fetch@^2.2.0, node-fetch@^2.5.0:
node-fetch@2.6.0, node-fetch@^2.2.0, node-fetch@^2.3.0, node-fetch@^2.5.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
@ -8492,7 +8492,7 @@ scheduler@0.15.0, scheduler@^0.15.0:
loose-envify "^1.1.0"
object-assign "^4.1.1"
secp256k1@^3.3.1:
secp256k1@^3.5.2:
version "3.7.1"
resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.7.1.tgz#12e473e0e9a7c2f2d4d4818e722ad0e14cc1e2f1"
integrity sha512-1cf8sbnRreXrQFdH6qsg2H71Xw91fCCS9Yp021GnUNJzWJS/py96fS4lHbnTnouLp08Xj6jBoBB6V78Tdbdu5g==
@ -9660,11 +9660,6 @@ whatwg-fetch@3.0.0, whatwg-fetch@>=0.10.0, whatwg-fetch@^3.0.0:
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb"
integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==
whatwg-fetch@^2.0.3:
version "2.0.4"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f"
integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==
whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"