Skip to content
Permalink
Browse files

Merge with master

  • Loading branch information...
kbardi committed Jun 12, 2019
2 parents 4493620 + 215f54b commit 871bf2ef6cc17f630016d2c973c595ad0d21e392
Showing with 946 additions and 592 deletions.
  1. +1 −0 .eslintignore
  2. +100 −6 .eslintrc
  3. +36 −23 loadtest/loadTest.js
  4. +5 −4 loadtest/mock-browser.js
  5. +5 −2 package-lock.json
  6. +2 −1 package.json
  7. +2 −3 src/App.js
  8. +2 −1 src/__tests__/App.js
  9. +2 −1 src/components/appNavigation/AppNavigation.js
  10. +2 −1 src/components/appNavigation/NavBar.js
  11. +1 −1 src/components/appNavigation/TabsView.js
  12. +1 −1 src/components/appNavigation/__tests__/AppNavigation.js
  13. +1 −1 src/components/appNavigation/__tests__/TabsView.js
  14. +2 −2 src/components/appNavigation/__tests__/stackNavigation.js
  15. +16 −10 src/components/appNavigation/stackNavigation.js
  16. +15 −4 src/components/appSwitch/AppSwitch.js
  17. +8 −5 src/components/auth/Auth.js
  18. +1 −4 src/components/backupWallet/BackupWallet.js
  19. +1 −1 src/components/backupWallet/BackupWalletState.js
  20. +4 −4 src/components/common/BigGoodDollar.js
  21. +1 −1 src/components/common/BigNumber.js
  22. +0 −1 src/components/common/CustomButton.js
  23. +1 −1 src/components/common/CustomDialog.js
  24. +5 −8 src/components/common/EventDialog.js
  25. +1 −1 src/components/common/IconButton.js
  26. +1 −1 src/components/common/InputGoodDollar.js
  27. +1 −1 src/components/common/ScanQRButton.js
  28. +4 −1 src/components/common/Section.js
  29. +3 −1 src/components/common/UserAvatar.js
  30. +1 −1 src/components/common/__tests__/Address.js
  31. +1 −1 src/components/common/__tests__/Avatar.js
  32. +1 −1 src/components/common/__tests__/BigGoodDollar.js
  33. +1 −1 src/components/common/__tests__/BigNumber.js
  34. +1 −1 src/components/common/__tests__/CustomButton.js
  35. +1 −0 src/components/common/__tests__/CustomDialog.js
  36. +1 −0 src/components/common/__tests__/EventDialog.js
  37. +1 −1 src/components/common/__tests__/IconButton.js
  38. +1 −1 src/components/common/__tests__/InputGoodDollar.js
  39. +1 −0 src/components/common/__tests__/LoadingIndicator.js
  40. +1 −1 src/components/common/__tests__/Section.js
  41. +1 −0 src/components/common/__tests__/TopBar.js
  42. +1 −1 src/components/common/__tests__/UserAvatar.js
  43. +1 −1 src/components/common/index.js
  44. +3 −4 src/components/dashboard/Amount.js
  45. +6 −6 src/components/dashboard/Claim.js
  46. +3 −3 src/components/dashboard/Dashboard.js
  47. +3 −1 src/components/dashboard/FaceRecognition/Camera.web.js
  48. +34 −20 src/components/dashboard/FaceRecognition/FaceRecognition.web.js
  49. +3 −3 src/components/dashboard/FaceRecognition/Zoom.js
  50. +1 −1 src/components/dashboard/FeedActions.js
  51. +1 −1 src/components/dashboard/FeedItems/EventCounterParty.js
  52. +4 −4 src/components/dashboard/FeedItems/FeedModalItem.js
  53. +1 −1 src/components/dashboard/FeedItems/ListEventItem.js
  54. +2 −2 src/components/dashboard/FeedItems/ModalReceiveEvent.js
  55. +2 −2 src/components/dashboard/FeedItems/ModalSendEvent.js
  56. +3 −3 src/components/dashboard/FeedItems/__tests__/EventCounterParty.js
  57. +1 −1 src/components/dashboard/FeedItems/__tests__/EventIcon.js
  58. +1 −1 src/components/dashboard/FeedItems/__tests__/FeedListItem.js
  59. +1 −0 src/components/dashboard/FeedItems/__tests__/FeedModalItem.js
  60. +1 −0 src/components/dashboard/FeedItems/__tests__/ListEventItem.js
  61. +1 −0 src/components/dashboard/FeedItems/__tests__/ModalReceiveEvent.js
  62. +1 −0 src/components/dashboard/FeedItems/__tests__/ModalSendEvent.js
  63. +1 −1 src/components/dashboard/FeedItems/__tests__/__util__/index.js
  64. +32 −32 src/components/dashboard/FeedList.js
  65. +1 −1 src/components/dashboard/Reason.js
  66. +4 −3 src/components/dashboard/ReceiveAmount.js
  67. +2 −2 src/components/dashboard/ReceiveByQR.native.js
  68. +2 −2 src/components/dashboard/ReceiveByQR.web.js
  69. +14 −6 src/components/dashboard/Send.js
  70. +4 −2 src/components/dashboard/SendConfirmation.web.js
  71. +8 −5 src/components/dashboard/SendLinkSummary.js
  72. +13 −7 src/components/dashboard/SendQRSummary.js
  73. +2 −1 src/components/dashboard/__tests__/Amount.js
  74. +2 −1 src/components/dashboard/__tests__/Claim.js
  75. +2 −1 src/components/dashboard/__tests__/Dashboard.js
  76. +2 −1 src/components/dashboard/__tests__/FaceRecognition.js
  77. +1 −1 src/components/dashboard/__tests__/FeedActions.js
  78. +2 −1 src/components/dashboard/__tests__/FeedList.js
  79. +1 −0 src/components/dashboard/__tests__/Reason.js
  80. +2 −1 src/components/dashboard/__tests__/Receive.js
  81. +1 −0 src/components/dashboard/__tests__/Send.js
  82. +1 −0 src/components/dashboard/__tests__/SendConfirmation.js
  83. +1 −0 src/components/dashboard/__tests__/SendLinkSummary.js
  84. +1 −0 src/components/dashboard/__tests__/__util__/index.js
  85. +5 −3 src/components/profile/EditProfile.web.js
  86. +1 −4 src/components/profile/Profile.js
  87. +1 −2 src/components/profile/ProfileDataTable.js
  88. +1 −1 src/components/profile/__tests__/Profile.js
  89. +1 −1 src/components/sidemenu/SideMenuItem.js
  90. +7 −5 src/components/sidemenu/SideMenuPanel.js
  91. +4 −3 src/components/signin/MnemonicInput.js
  92. +3 −7 src/components/signin/Mnemonics.js
  93. +1 −1 src/components/signin/SignInState.js
  94. +1 −1 src/components/signup/EmailConfirmation.js
  95. +1 −1 src/components/signup/EmailForm.js
  96. +2 −2 src/components/signup/NameForm.js
  97. +2 −2 src/components/signup/PhoneForm.web.js
  98. +2 −1 src/components/signup/SignupCompleted.js
  99. +52 −46 src/components/signup/SignupState.js
  100. +4 −5 src/components/signup/SmsForm.web.js
  101. +1 −0 src/components/signup/__tests__/SmsForm.web.js
  102. +1 −2 src/components/signup/components.js
  103. +1 −1 src/components/splash/Splash.js
  104. +1 −1 src/components/webView/WebViewScreen.js
  105. +2 −2 src/components/webView/__tests__/WebViewScreen.js
  106. +2 −23 src/index.js
  107. +5 −3 src/init.js
  108. +3 −3 src/lib/API/api.js
  109. +1 −1 src/lib/API/useWrappedApi.js
  110. +16 −6 src/lib/gundb/UserModel.js
  111. +136 −67 src/lib/gundb/UserStorage.js
  112. +47 −73 src/lib/gundb/__tests__/UserStorage.js
  113. +1 −1 src/lib/gundb/__tests__/__util__/index.js
  114. +3 −1 src/lib/gundb/gundb-extend.js
  115. +7 −2 src/lib/gundb/gundb.js
  116. +2 −2 src/lib/gundb/useWrappedStorage.js
  117. +3 −1 src/lib/logger/pino-logger.js
  118. +2 −2 src/lib/login/GoodWalletLogin.js
  119. +9 −4 src/lib/login/LoginService.js
  120. +0 −3 src/lib/login/checkAuthStatus.js
  121. +0 −2 src/lib/share/__tests__/generateCode.js
  122. +0 −1 src/lib/share/__tests__/readReceiveLink.js
  123. +4 −1 src/lib/share/index.js
  124. +2 −2 src/lib/undux/GDStore.js
  125. +1 −1 src/lib/undux/effects/balanceChange.js
  126. +6 −2 src/lib/undux/effects/profile.js
  127. +3 −1 src/lib/undux/utils/account.js
  128. +0 −1 src/lib/undux/utils/feed.js
  129. +1 −1 src/lib/undux/utils/withdraw.js
  130. +2 −2 src/lib/undux/utils/wrapper.js
  131. +1 −0 src/lib/utils/Clipboard.web.js
  132. +1 −1 src/lib/validators/__tests__/validateFullName.js
  133. +158 −54 src/lib/wallet/GoodWallet.js
  134. +5 −1 src/lib/wallet/MultipleAddressWallet.js
  135. +13 −11 src/lib/wallet/SoftwareWalletProvider.js
  136. +7 −4 src/lib/wallet/WalletFactory.js
  137. +1 −1 src/lib/wallet/__tests__/GoodWallet.js
  138. +1 −1 src/lib/wallet/useWrappedWallet.js
@@ -4,5 +4,6 @@ assets
config
flow-typed
scripts
public/ZoomAuthentication.js
/*.js
/src/serviceWorker.js
106 .eslintrc
@@ -1,6 +1,7 @@
{
"extends": [
"react-app",
"eslint:recommended",
"plugin:flowtype/recommended",
"plugin:import/recommended",
"plugin:prettier/recommended",
@@ -33,25 +34,118 @@
".js",
".android.js",
".ios.js",
".web.js"
".web.js",
".native.js"
]
}
},
"dependencies/resolver": {
"node": {
"paths": [
"src"
]
},
"extensions": [
".js",
".android.js",
".ios.js",
".web.js",
".native.js"
]
}
},
"rules": {
"prettier/prettier": "error",
"react/prop-types": "off",
"react/display-name": "off",
"react-hooks/rules-of-hooks": "warn",
"react-hooks/rules-of-hooks": "error",
"dependencies/no-cycles": "error",
"dependencies/no-unresolved": [
"import/no-unresolved": "error",
"import/first": "error",
"import/no-duplicates": "error",
"import/order": [
"warn",
{
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
]
}
],
"sort-imports": [
"warn",
{
"ignore": [
"web3"
"ignoreCase": true,
"ignoreDeclarationSort": true
}
],
"no-console": [
"error",
{
"allow": [
"info"
]
}
],
"import/no-unresolved": "warn"
"no-await-in-loop": "error",
"curly": "error",
"dot-notation": "error",
"no-else-return": "error",
"no-implicit-coercion": [
"error",
{
"boolean": false
}
],
"no-return-await": "error",
"no-useless-catch": "error",
"require-await": "error",
"array-bracket-newline": [
"error",
{
"multiline": true
}
],
"block-spacing": "error",
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"camelcase": [
"error",
{
"ignoreDestructuring": true,
"properties": "never"
}
],
"comma-dangle": "error",
"comma-spacing": "error",
"computed-property-spacing": "error",
"lines-between-class-members": "error",
"lines-around-comment": [
"error",
{
"beforeBlockComment": true,
"beforeLineComment": true,
"allowBlockStart": true,
"allowObjectStart": true,
"allowArrayStart": true,
"allowClassStart": true,
"afterBlockComment": false,
"afterLineComment": false,
"allowBlockEnd": false,
"allowObjectEnd": false,
"allowArrayEnd": false,
"allowClassEnd": false
}
],
"no-negated-condition": "error"
}
}
@@ -1,15 +1,14 @@
import './mock-browser'
import { GoodWallet } from '../src/lib/wallet/GoodWallet'
import fs from 'fs'
import bip39 from 'bip39-light'
import faker from 'faker'
import FormData from 'form-data'
import fetch from 'node-fetch'
import { GoodWallet } from '../src/lib/wallet/GoodWallet'
import { GoodWalletLogin } from '../src/lib/login/GoodWalletLogin'
import { UserStorage } from '../src/lib/gundb/UserStorage'
import Config from '../src/config/config'
import API from '../src/lib/API/api'
import faker from 'faker'
import range from 'lodash/range'
import FormData from 'form-data'
import fs from 'fs'
import fetch from 'node-fetch'
const Timeout = (timeout = 3000) => {
return new Promise((res, rej) => {
setTimeout(res, timeout)
@@ -42,11 +41,13 @@ export const mytest = async i => {
let login = new GoodWalletLogin(wallet, storage)
await storage.ready
let creds = await login.auth()
// console.log({ creds })

// console.info({ creds })
var randomName = faker.name.findName() // Rowan Nikolaus
var randomEmail = faker.internet.email() // Kassandra.Haley@erich.biz
var randomCard = faker.phone.phoneNumber('+97250#######')
// console.log(randomCard, randomName, randomEmail)

// console.info(randomCard, randomName, randomEmail)
let adduser = await Promise.race([
Timeout(20000).then(x => {
throw new Error('adduser timeout')
@@ -58,8 +59,10 @@ export const mytest = async i => {
walletAddress: wallet.account
})
])
console.log('/user/add:', adduser.data)
if (adduser.data.ok !== 1) throw new Error('adduser failed')
console.info('/user/add:', adduser.data)
if (adduser.data.ok !== 1) {
throw new Error('adduser failed')
}
await storage.setProfile({
fullName: randomName,
email: randomEmail,
@@ -73,15 +76,23 @@ export const mytest = async i => {
createReq(wallet.getAccountForType('zoomId'), creds.jwt).then(r => r.json())
])

console.log('/verify/facerecognition:', fr)
if (fr.ok !== 1) throw new Error(`FR failed`)
console.info('/verify/facerecognition:', fr)
if (fr.ok !== 1) {
throw new Error(`FR failed`)
}
let gunres = 0
await new Promise((res, rej) => {
gun.get('users/byemail').once(r => {
if (r && r.err) rej(new Error(r.err))
if (!r) rej(new Error('Empty gun data'))
else if (++gunres === 1) res()
if (r && r.err) {
rej(new Error(r.err))
}
if (!r) {
rej(new Error('Empty gun data'))
} else if (++gunres === 1) {
res()
}
})

// // gun.get('users/bymobile').open(r => {
// // if (r.err) rej(new Error(r.err))
// // else if (++gunres === 2) res()
@@ -92,8 +103,8 @@ export const mytest = async i => {
// // })
})
} catch (error) {
console.log(`Test failed`, error)
failedTests[error.message] !== undefined ? (failedTests[error.message] += 1) : (failedTests[error.message] = 1)
console.info(`Test failed`, error)
failedTests[error.message] === undefined ? (failedTests[error.message] = 1) : (failedTests[error.message] += 1)
} finally {
// fs.unlinkSync('./loadtest/loadtest' + i + '.json')
}
@@ -102,19 +113,21 @@ const run = async numTests => {
let promises = []
for (let i = 0; i < numTests; i++) {
promises[i] = mytest(i)
// eslint-disable-next-line no-await-in-loop
await Timeout(10000)
}
console.log('Waiting for tests to finish...')
console.info('Waiting for tests to finish...')
await Promise.all(promises)
console.log('Done running tests', { total: promises.length, failedTests })
console.log('Waiting for server memory stats')
console.info('Done running tests', { total: promises.length, failedTests })
console.info('Waiting for server memory stats')
await Timeout(5000)
console.log('Done. Quiting')
console.info('Done. Quiting')
process.exit(-1)
}
let numTests = process.argv[2]
console.log('arrgs', process.argv, numTests)
console.info('arrgs', process.argv, numTests)
run(numTests)

// describe('load test', () => {
// it('loadtest', async () => {
// const doLogin = async () => {
@@ -124,7 +137,7 @@ run(numTests)
// expect(wallet).toBeTruthy()
// let login = new GoodWalletLogin(wallet)
// let creds = await login.auth()
// console.log({ creds })
// console.info({ creds })
// return expect(creds).toBeTruthy()
// }
// let promises = range(3).map(i => doLogin())
@@ -1,9 +1,10 @@
import { LocalStorage } from 'node-localStorage'
import Config from '../src/config/config'
import { LocalStorage } from 'node-localstorage'
import Gun from 'gun'
import SEA from 'gun/sea'
import load from 'gun/lib/load'
import 'gun/lib/load'
import Config from '../src/config/config'

// eslint-disable-next-line no-unused-vars
const extend = (() => {
Gun.chain.putAck = function(data, cb) {
var gun = this,
@@ -61,4 +62,4 @@ global.window = {}
global.window.localStorage = new LocalStorage('./localStorage.tmp')
global.gun = Gun([Config.gunPublicUrl])
global.Gun = Gun
console.log('here')
console.info('here')

Some generated files are not rendered by default. Learn more.

@@ -27,7 +27,8 @@
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls",
"bundlesize:check": "bundlesize",
"flow": "flow",
"fix-lint": "eslint --fix ./src",
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"docs": "node scripts/docs.js"
},
"repository": {
@@ -2,11 +2,9 @@
import React, { Component } from 'react'
import { Platform, SafeAreaView, StyleSheet, View } from 'react-native'
import { Provider as PaperProvider } from 'react-native-paper'

// import { loadReCaptcha } from 'recaptcha-v3-react'

import Config from './config/config'
import userStorage from './lib/gundb/UserStorage'
import logger from './lib/logger/pino-logger'
import GDStore from './lib/undux/GDStore'
import { WebRouter } from './Router'

@@ -63,5 +61,6 @@ if (Platform.OS === 'web') {
const { hot } = require('react-hot-loader')
hotWrapper = hot
}

//$FlowFixMe
export default hotWrapper(module)(App)
@@ -1,7 +1,8 @@
import React from 'react'

// Note: test renderer must be required after react-native.
import App from '../App'
import renderer from 'react-test-renderer'
import App from '../App'

describe('App', () => {
it('renders without errors', () => {
@@ -2,14 +2,14 @@
import { createSwitchNavigator } from '@react-navigation/core'
import React from 'react'
import type { Store } from 'undux'
import { navigationOptions } from './navigationConfig'

// TODO: Should we do this diferently?
import homeIcon from '../../assets/homeIcon.png'

import GDStore from '../../lib/undux/GDStore'
import Dashboard from '../dashboard/Dashboard'
import Profile from '../profile/Profile'
import { navigationOptions } from './navigationConfig'

/**
* @type
@@ -50,6 +50,7 @@ const AppNavigator = createSwitchNavigator(routes, { initialRouteName })
class AppNavigation extends React.Component<AppNavigationProps, AppNavigationState> {
render() {
const account = this.props.store.get('account')

// `account.ready` will be set to `true` after retrieving the required user information in `updateAll`,
// if not ready will display a blank screen (`null`)
return account.ready ? <AppNavigator navigation={this.props.navigation} screenProps={{ routes }} /> : null
@@ -1,6 +1,6 @@
//@flow
import React from 'react'
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'
import backButton from '../../assets/backButton.png'

/**
@@ -10,6 +10,7 @@ type NavBarProps = {
goBack?: () => void,
title: string
}

/**
* NavigationBar shows title and back button
* @name NavBar

0 comments on commit 871bf2e

Please sign in to comment.
You can’t perform that action at this time.