Skip to content

Commit e7fd8dc

Browse files
authored
Merge pull request #322 from EdgeApp/william/rn-cleanup
RN cleanup
2 parents a56a476 + fcc8b19 commit e7fd8dc

31 files changed

Lines changed: 256 additions & 339 deletions

localizeLanguage.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
const fs = require('fs')
2-
const masterStrings = require('./packages/edge-login-ui-rn/src/common/locales/en_US.js')
3-
fs.writeFileSync(
1+
import { writeFileSync } from 'fs'
2+
3+
import strings from './packages/edge-login-ui-rn/src/common/locales/en_US'
4+
5+
writeFileSync(
46
'./packages/edge-login-ui-rn/src/common/locales/strings/enUS.json',
5-
JSON.stringify(masterStrings, null, 2)
7+
JSON.stringify(strings, null, 2)
68
)

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"fix": "npm run lint -- --fix",
88
"flow": "flow",
99
"lint": "eslint .",
10-
"precommit": "node localizeLanguage.js && lint-staged && flow",
10+
"precommit": "node -r sucrase/register localizeLanguage.js && lint-staged && flow",
1111
"prepare": "lerna exec yarn prepare"
1212
},
1313
"husky": {
@@ -38,6 +38,7 @@
3838
"husky": "^4.3.0",
3939
"lerna": "^3.16.4",
4040
"lint-staged": "^10.5.3",
41-
"prettier": "^2.2.0"
41+
"prettier": "^2.2.0",
42+
"sucrase": "^3.19.0"
4243
}
4344
}

packages/edge-login-ui-rn/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"cleaners": "^0.3.1",
3434
"qrcode-generator": "^1.4.4",
3535
"react-native-airship": "^0.2.6",
36-
"react-native-extra-dimensions-android": "^1.2.5",
36+
"react-native-gesture-handler": "^1.10.3",
3737
"react-native-keyboard-aware-scroll-view": "^0.9.1",
3838
"react-native-linear-gradient": "^2.0.0",
3939
"react-native-localize": "^2.0.2",

packages/edge-login-ui-rn/src/actions/CreateAccountActions.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import * as Constants from '../constants/index.js'
88
import { enableTouchId, isTouchDisabled } from '../keychain.js'
99
import type { Dispatch, GetState, Imports } from '../types/ReduxTypes.js'
1010
import { logEvent } from '../util/analytics.js'
11-
import { isASCII } from '../util/ASCIIUtil.js'
1211
import { getPreviousUsers, setMostRecentUsers } from './PreviousUsersActions.js'
1312

1413
export type CreateUserData = {
@@ -56,6 +55,11 @@ export function checkUsernameForAvailabilty(data: string) {
5655
})
5756
}
5857

58+
function isASCII(str: string) {
59+
// eslint-disable-next-line no-control-regex
60+
return /^[\x00-\x7F]*$/.test(str)
61+
}
62+
5963
export function validateUsername(data: string) {
6064
return (dispatch: Dispatch, getState: GetState, imports: Imports) => {
6165
// TODO evaluate client side evaluations.
Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,20 @@
11
// @flow
22

3-
const LOGO_DOT = require('./logoHolderDot.png')
4-
const LOGO_BIG = require('./edgeLogo/Edge_logo_L.png')
5-
const LOGO_SMALL = require('./edgeLogo/Edge_logo_S.png')
6-
const REVIEW_CHECKED = require('./icons/review/check.png')
7-
const REVIEW_UNCHECKED = require('./icons/review/unchecked.png')
8-
const STANDARD_CHECKED = require('./icons/standard/password_show.png')
9-
const STANDARD_UNCHECKED = require('./icons/standard/password_hide.png')
10-
const PASSWORD_REQ_CHECKED = require('./icons/passwordRequirements/checked.png')
11-
const PASSWORD_REQ_UNCHECKED = require('./icons/passwordRequirements/unchecked.png')
12-
const PERMISSIONS_CAMREA = require('./icons/permissions/permissions-camera.png')
13-
const WELCOME_LOCK = require('./icons/welcome/lock.png')
14-
const WELCOME_SHIELD_KEY = require('./icons/welcome/shield_key.png')
15-
const TOUCH = require('./touch/touchid.png')
16-
const OTP = require('./icons/otp/OTP-badge.png')
17-
const OTP_SMALL = require('./icons/otp/OTP-badge_sm.png')
18-
const OTP_DISABLE = require('./icons/otp/OTP-disable.png')
19-
const FACE_ID = require('./touch/face-id.png')
20-
const TOUCH_ID = require('./touch/touch-id.png')
21-
22-
export { LOGO_BIG }
23-
export { LOGO_DOT }
24-
export { LOGO_SMALL }
25-
export { REVIEW_CHECKED }
26-
export { REVIEW_UNCHECKED }
27-
export { STANDARD_CHECKED }
28-
export { STANDARD_UNCHECKED }
29-
export { PASSWORD_REQ_CHECKED }
30-
export { PASSWORD_REQ_UNCHECKED }
31-
export { PERMISSIONS_CAMREA }
32-
export { WELCOME_LOCK }
33-
export { WELCOME_SHIELD_KEY }
34-
export { TOUCH }
35-
export { OTP }
36-
export { OTP_SMALL }
37-
export { OTP_DISABLE }
38-
export { FACE_ID }
39-
export { TOUCH_ID }
3+
export const LOGO_DOT = require('./logoHolderDot.png')
4+
export const LOGO_BIG = require('./edgeLogo/Edge_logo_L.png')
5+
export const LOGO_SMALL = require('./edgeLogo/Edge_logo_S.png')
6+
export const REVIEW_CHECKED = require('./icons/review/check.png')
7+
export const REVIEW_UNCHECKED = require('./icons/review/unchecked.png')
8+
export const STANDARD_CHECKED = require('./icons/standard/password_show.png')
9+
export const STANDARD_UNCHECKED = require('./icons/standard/password_hide.png')
10+
export const PASSWORD_REQ_CHECKED = require('./icons/passwordRequirements/checked.png')
11+
export const PASSWORD_REQ_UNCHECKED = require('./icons/passwordRequirements/unchecked.png')
12+
export const PERMISSIONS_CAMREA = require('./icons/permissions/permissions-camera.png')
13+
export const WELCOME_LOCK = require('./icons/welcome/lock.png')
14+
export const WELCOME_SHIELD_KEY = require('./icons/welcome/shield_key.png')
15+
export const TOUCH = require('./touch/touchid.png')
16+
export const OTP = require('./icons/otp/OTP-badge.png')
17+
export const OTP_SMALL = require('./icons/otp/OTP-badge_sm.png')
18+
export const OTP_DISABLE = require('./icons/otp/OTP-disable.png')
19+
export const FACE_ID = require('./touch/face-id.png')
20+
export const TOUCH_ID = require('./touch/touch-id.png')

packages/edge-login-ui-rn/src/common/locales/en_US.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @flow
2-
const strings = {
2+
3+
export default {
34
app_name_default: 'Edge',
45
edge_site: 'https://edge.app/',
56
login_button: 'Login',
@@ -280,5 +281,3 @@ const strings = {
280281
'Name the make, model, and year of your dream car?',
281282
change_recovery_question13: 'Who is your childhood sports hero?'
282283
}
283-
284-
module.exports = strings

packages/edge-login-ui-rn/src/components/abSpecific/ImageHeaderComponent.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/edge-login-ui-rn/src/components/abSpecific/UserListItem.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type Props = {
2020
onDelete(string): void
2121
}
2222

23-
class UserListItem extends React.Component<Props> {
23+
export class UserListItem extends React.Component<Props> {
2424
handleDelete = () => {
2525
this.props.onDelete(this.props.data)
2626
}
@@ -65,5 +65,3 @@ class UserListItem extends React.Component<Props> {
6565
)
6666
}
6767
}
68-
69-
export { UserListItem }

packages/edge-login-ui-rn/src/components/common/Button.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type State = {
2222
pressed: boolean
2323
}
2424

25-
class Button extends React.Component<Props, State> {
25+
export class Button extends React.Component<Props, State> {
2626
constructor(props: Props) {
2727
super(props)
2828
this.state = {
@@ -92,5 +92,3 @@ class Button extends React.Component<Props, State> {
9292
}
9393
}
9494
}
95-
96-
export { Button }

packages/edge-login-ui-rn/src/components/common/Checkbox.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Props = {
1717
type State = {
1818
onOff: boolean
1919
}
20-
class Checkbox extends React.Component<Props, State> {
20+
export class Checkbox extends React.Component<Props, State> {
2121
constructor(props: Props) {
2222
super(props)
2323
this.state = {
@@ -80,5 +80,3 @@ class Checkbox extends React.Component<Props, State> {
8080
this.props.onChange(this.state.onOff)
8181
}
8282
}
83-
84-
export { Checkbox }

0 commit comments

Comments
 (0)