This commit is contained in:
feruz 2020-03-24 11:42:49 +02:00
parent cb8e2cd7b3
commit 0c000085bb
4 changed files with 105 additions and 97 deletions

View File

@ -434,6 +434,7 @@
TargetAttributes = {
00E356ED1AD99517003FC87E = {
CreatedOnToolsVersion = 6.2;
DevelopmentTeam = 6JSWX82A29;
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
@ -862,6 +863,8 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
DEVELOPMENT_TEAM = 6JSWX82A29;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
@ -886,7 +889,9 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
COPY_PHASE_STRIP = NO;
DEVELOPMENT_TEAM = 6JSWX82A29;
INFOPLIST_FILE = eSteemTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
@ -909,7 +914,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = eSteem/eSteem.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 2466;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 75B6RXTKGT;
HEADER_SEARCH_PATHS = (
@ -965,7 +970,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = app.esteem.mobile.ios;
PRODUCT_NAME = Esteem;
PROVISIONING_PROFILE_SPECIFIER = dev;
PROVISIONING_PROFILE_SPECIFIER = dev09Dec;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
@ -980,7 +985,7 @@
CODE_SIGN_ENTITLEMENTS = eSteem/eSteem.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 2466;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 75B6RXTKGT;
HEADER_SEARCH_PATHS = (
@ -1036,7 +1041,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = app.esteem.mobile.ios;
PRODUCT_NAME = Esteem;
PROVISIONING_PROFILE_SPECIFIER = prod;
PROVISIONING_PROFILE_SPECIFIER = prod_02_2021;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};

View File

@ -37,7 +37,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1682</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
@ -46,12 +46,12 @@
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<key>hivesigner.com</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
<key>hivesigner.com</key>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>

View File

@ -3,8 +3,11 @@ import ePointApi from '../../config/api';
import { jsonStringify } from '../../utils/jsonUtils';
export const userActivity = (us, ty, bl = '', tx = '') =>
new Promise(resolve => {
const params = { us, ty };
new Promise((resolve) => {
const params = {
us,
ty,
};
if (bl) {
params.bl = bl;
@ -13,51 +16,50 @@ export const userActivity = (us, ty, bl = '', tx = '') =>
if (tx) {
params.tx = tx;
}
Alert.alert('Error1', jsonStringify(params));
ePointApi
.post('/usr-activity', params)
.then(res => {
.then((res) => {
resolve(res.data);
})
.catch(error => {
.catch((error) => {
Alert.alert('Error', error.message);
});
});
export const getUser = username =>
new Promise(resolve => {
export const getUser = (username) =>
new Promise((resolve) => {
ePointApi
.get(`/users/${username}`)
.then(res => {
.then((res) => {
resolve(res.data);
})
.catch(error => {
.catch((error) => {
Alert.alert('Error', error.message);
});
});
export const getUserPoints = username =>
new Promise(resolve => {
export const getUserPoints = (username) =>
new Promise((resolve) => {
ePointApi
.get(`/users/${username}/points`)
.then(res => {
.then((res) => {
resolve(res.data);
})
.catch(error => {
.catch((error) => {
Alert.alert('Error', error.message);
});
});
export const claim = username =>
export const claim = (username) =>
new Promise((resolve, reject) => {
ePointApi
.put('/claim', {
us: `${username}`,
})
.then(res => {
.then((res) => {
resolve(res.data);
})
.catch(error => {
.catch((error) => {
reject(error);
});
});
@ -65,11 +67,15 @@ export const claim = username =>
export const gameStatusCheck = (username, type) =>
new Promise((resolve, reject) => {
ePointApi
.get(`/game/${username}`, { params: { type } })
.then(res => {
.get(`/game/${username}`, {
params: {
type,
},
})
.then((res) => {
resolve(res.data);
})
.catch(error => {
.catch((error) => {
reject(error);
});
});
@ -77,11 +83,13 @@ export const gameStatusCheck = (username, type) =>
export const gameClaim = (username, type, key) =>
new Promise((resolve, reject) => {
ePointApi
.post(`/game/${username}?type=${type}`, { key })
.then(res => {
.post(`/game/${username}?type=${type}`, {
key,
})
.then((res) => {
resolve(res.data);
})
.catch(error => {
.catch((error) => {
reject(error);
});
});

View File

@ -29,7 +29,7 @@ let client = new Client(DEFAULT_SERVER);
export const checkClient = async () => {
let selectedServer = DEFAULT_SERVER;
await getServer().then(response => {
await getServer().then((response) => {
if (response) {
selectedServer = response;
}
@ -40,7 +40,7 @@ export const checkClient = async () => {
checkClient();
export const getDigitPinCode = pin => decryptKey(pin, Config.PIN_KEY);
export const getDigitPinCode = (pin) => decryptKey(pin, Config.PIN_KEY);
export const getDynamicGlobalProperties = () => client.database.getDynamicGlobalProperties();
@ -93,7 +93,7 @@ export const fetchGlobalProps = async () => {
* @method getAccount get account data
* @param user username
*/
export const getAccount = user =>
export const getAccount = (user) =>
new Promise((resolve, reject) => {
try {
const account = client.database.getAccounts([user]);
@ -107,7 +107,7 @@ export const getAccount = user =>
* @method getAccount get account data
* @param user username
*/
export const getState = async path => {
export const getState = async (path) => {
try {
const state = await client.database.getState(path);
return state;
@ -120,7 +120,7 @@ export const getState = async path => {
* @method getUser get account data
* @param user username
*/
export const getUser = async user => {
export const getUser = async (user) => {
try {
const account = await client.database.getAccounts([user]);
const _account = { ...account[0] };
@ -183,7 +183,7 @@ export const vestToSteem = async (vestingShares, totalVestingShares, totalVestin
(parseFloat(vestingShares) / parseFloat(totalVestingShares))
).toFixed(0);
export const getFollows = username => client.database.call('get_follow_count', [username]);
export const getFollows = (username) => client.database.call('get_follow_count', [username]);
export const getFollowing = (follower, startFollowing, followType = 'blog', limit = 100) =>
client.database.call('get_following', [follower, startFollowing, followType, limit]);
@ -195,14 +195,14 @@ export const getIsFollowing = (user, author) =>
new Promise((resolve, reject) => {
client.database
.call('get_following', [author, user, 'blog', 1])
.then(result => {
.then((result) => {
if (result[0] && result[0].follower === author && result[0].following === user) {
resolve(true);
} else {
resolve(false);
}
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -211,14 +211,14 @@ export const getFollowSearch = (user, targetUser) =>
new Promise((resolve, reject) => {
client.database
.call('get_following', [targetUser, user, 'blog', 1])
.then(result => {
.then((result) => {
if (result[0] && result[0].follower === targetUser && result[0].following === user) {
resolve(result);
} else {
resolve(null);
}
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -274,10 +274,10 @@ export const ignoreUser = async (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.json(json, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -308,10 +308,10 @@ export const getActiveVotes = (author, permlink) =>
new Promise((resolve, reject) => {
client.database
.call('get_active_votes', [author, permlink])
.then(result => {
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -334,7 +334,7 @@ export const getPostsSummary = async (by, query, currentUserName, filterNsfw) =>
}
};
export const getUserComments = async query => {
export const getUserComments = async (query) => {
try {
const comments = await client.database.getDiscussions('comments', query);
const groomedComments = await parseComments(comments);
@ -344,7 +344,7 @@ export const getUserComments = async query => {
}
};
export const getRepliesByLastUpdate = async query => {
export const getRepliesByLastUpdate = async (query) => {
try {
const replies = await client.database.call('get_replies_by_last_update', [
query.start_author,
@ -404,7 +404,7 @@ export const deleteComment = (currentAccount, pin, permlink) => {
const opArray = [['delete_comment', params]];
return api.broadcast(opArray).then(resp => resp.result);
return api.broadcast(opArray).then((resp) => resp.result);
}
if (key) {
@ -445,10 +445,10 @@ export const getPostWithComments = async (user, permlink) => {
let post;
let comments;
await getPost(user, permlink).then(result => {
await getPost(user, permlink).then((result) => {
post = result;
});
await getComments(user, permlink).then(result => {
await getComments(user, permlink).then((result) => {
comments = result;
});
@ -462,8 +462,7 @@ export const getPostWithComments = async (user, permlink) => {
*/
export const vote = (account, pin, author, permlink, weight) =>
_vote(account, pin, author, permlink, weight).then(resp => {
alert(resp.block_num);
_vote(account, pin, author, permlink, weight).then((resp) => {
userActivity(account.username, 120, resp.block_num, resp.id);
return resp;
});
@ -471,7 +470,6 @@ export const vote = (account, pin, author, permlink, weight) =>
const _vote = async (currentAccount, pin, author, permlink, weight) => {
const digitPinCode = getDigitPinCode(pin);
const key = getAnyPrivateKey(currentAccount.local, digitPinCode);
alert(digitPinCode, key);
if (currentAccount.local.authType === AUTH_TYPE.STEEM_CONNECT) {
const token = decryptKey(currentAccount.local.accessToken, digitPinCode);
const api = new hivesigner.Client({
@ -483,19 +481,17 @@ const _vote = async (currentAccount, pin, author, permlink, weight) => {
return new Promise((resolve, reject) => {
api
.vote(voter, author, permlink, weight)
.then(result => {
.then((result) => {
resolve(result.result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
}
if (key) {
alert('key ' + key);
const privateKey = PrivateKey.fromString(key);
alert('pkey ' + privateKey);
const voter = currentAccount.name;
const args = {
voter,
@ -507,11 +503,10 @@ const _vote = async (currentAccount, pin, author, permlink, weight) => {
return new Promise((resolve, reject) => {
client.broadcast
.vote(args, privateKey)
.then(result => {
alert('res ' + jsonStringify(result));
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
alert(jsonStringify(err));
if (get(err, 'jse_info.code') === 4030100) {
err.message = getDsteemDateErrorMessage(err);
@ -527,11 +522,11 @@ const _vote = async (currentAccount, pin, author, permlink, weight) => {
/**
* @method upvoteAmount estimate upvote amount
*/
export const upvoteAmount = async input => {
export const upvoteAmount = async (input) => {
let medianPrice;
const rewardFund = await getRewardFund();
await client.database.getCurrentMedianHistoryPrice().then(res => {
await client.database.getCurrentMedianHistoryPrice().then((res) => {
medianPrice = res;
});
@ -558,12 +553,12 @@ export const transferToken = (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.transfer(args, privateKey)
.then(result => {
.then((result) => {
if (result) {
resolve(result);
}
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -593,12 +588,12 @@ export const convert = (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.sendOperations(args, privateKey)
.then(result => {
.then((result) => {
if (result) {
resolve(result);
}
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -629,10 +624,10 @@ export const transferToSavings = (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.sendOperations(args, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -663,10 +658,10 @@ export const transferFromSavings = (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.sendOperations(args, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -695,10 +690,10 @@ export const transferToVesting = (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.sendOperations(args, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -726,10 +721,10 @@ export const withdrawVesting = (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.sendOperations(args, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -758,10 +753,10 @@ export const delegateVestingShares = (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.sendOperations(args, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -791,10 +786,10 @@ export const setWithdrawVestingRoute = (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.sendOperations(args, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -803,7 +798,7 @@ export const setWithdrawVestingRoute = (currentAccount, pin, data) => {
return Promise.reject(new Error('Check private key permission!'));
};
export const getWithdrawRoutes = account =>
export const getWithdrawRoutes = (account) =>
client.database.call('get_withdraw_routes', [account, 'outgoing']);
export const followUser = async (currentAccount, pin, data) => {
@ -838,10 +833,10 @@ export const followUser = async (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.json(json, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -883,10 +878,10 @@ export const unfollowUser = async (currentAccount, pin, data) => {
return new Promise((resolve, reject) => {
client.broadcast
.json(json, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(err => {
.catch((err) => {
reject(err);
});
});
@ -895,7 +890,7 @@ export const unfollowUser = async (currentAccount, pin, data) => {
return Promise.reject(new Error('Check private key permission!'));
};
export const lookupAccounts = async username => {
export const lookupAccounts = async (username) => {
try {
const users = await client.database.call('lookup_accounts', [username, 20]);
return users;
@ -904,7 +899,7 @@ export const lookupAccounts = async username => {
}
};
export const getTrendingTags = async tag => {
export const getTrendingTags = async (tag) => {
try {
const users = await client.database.call('get_trending_tags', [tag, 20]);
return users;
@ -936,7 +931,7 @@ export const postContent = (
jsonMetadata,
options,
voteWeight,
).then(resp => {
).then((resp) => {
if (options) {
const t = title ? 100 : 110;
const { block_num, id } = resp;
@ -1002,7 +997,7 @@ const _postContent = async (
opArray.push(e);
}
return api.broadcast(opArray).then(resp => resp.result);
return api.broadcast(opArray).then((resp) => resp.result);
}
if (key) {
@ -1044,10 +1039,10 @@ const _postContent = async (
return new Promise((resolve, reject) => {
client.broadcast
.sendOperations(opArray, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(error => {
.catch((error) => {
if (get(error, 'jse_info.code') === 4030100) {
error.message = getDsteemDateErrorMessage(error);
}
@ -1062,7 +1057,7 @@ const _postContent = async (
// Re-blog
// TODO: remove pinCode
export const reblog = (account, pinCode, author, permlink) =>
_reblog(account, pinCode, author, permlink).then(resp => {
_reblog(account, pinCode, author, permlink).then((resp) => {
userActivity(account.name, 130, resp.block_num, resp.id);
return resp;
});
@ -1079,7 +1074,7 @@ const _reblog = async (account, pinCode, author, permlink) => {
const follower = account.name;
return api.reblog(follower, author, permlink).then(resp => resp.result);
return api.reblog(follower, author, permlink).then((resp) => resp.result);
}
if (key) {
@ -1251,8 +1246,8 @@ export const grantPostingPermission = async (json, pin, currentAccount) => {
return api
.broadcast(opArray)
.then(resp => resp.result)
.catch(error => console.log(error));
.then((resp) => resp.result)
.catch((error) => console.log(error));
}
if (key) {
@ -1272,10 +1267,10 @@ export const grantPostingPermission = async (json, pin, currentAccount) => {
return new Promise((resolve, reject) => {
client.broadcast
.sendOperations(opArray, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(error => {
.catch((error) => {
if (get(error, 'jse_info.code') === 4030100) {
error.message = getDsteemDateErrorMessage(error);
}
@ -1307,8 +1302,8 @@ export const profileUpdate = async (params, pin, currentAccount) => {
return api
.broadcast(opArray)
.then(resp => resp.result)
.catch(error => console.log(error));
.then((resp) => resp.result)
.catch((error) => console.log(error));
}
if (key) {
@ -1328,10 +1323,10 @@ export const profileUpdate = async (params, pin, currentAccount) => {
return new Promise((resolve, reject) => {
client.broadcast
.sendOperations(opArray, privateKey)
.then(result => {
.then((result) => {
resolve(result);
})
.catch(error => {
.catch((error) => {
if (get(error, 'jse_info.code') === 4030100) {
error.message = getDsteemDateErrorMessage(error);
}