From 2d8aa768dc9c63cb0b45a3921417ae7ee79f3a23 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Fri, 27 Sep 2019 20:43:44 -0400 Subject: [PATCH] misc cleanup --- src/components/identity/AddIdentity.js | 67 ---------------------- src/components/identity/AddIdentityMenu.js | 4 -- src/components/identity/GenericSocial.js | 5 -- src/components/identity/ShareButton.js | 3 + src/components/profile/EditProfile.js | 2 - 5 files changed, 3 insertions(+), 78 deletions(-) diff --git a/src/components/identity/AddIdentity.js b/src/components/identity/AddIdentity.js index 26920d8d3e..54252b9b89 100644 --- a/src/components/identity/AddIdentity.js +++ b/src/components/identity/AddIdentity.js @@ -2,7 +2,6 @@ import React from 'react' import { Clipboard, TouchableOpacity } from 'react-native' -//import GDStore from '../../lib/undux/GDStore' import { SaveButton, Section, Text, Wrapper } from '../common' import InputRounded from '../common/form/InputRounded' import { useScreenState } from '../appNavigation/stackNavigation' @@ -11,78 +10,12 @@ import { withStyles } from '../../lib/styles' const TITLE = 'Add Identity' const AddIdentity = ({ screenProps, theme, styles }) => { - //initialize identity value for first time from storedidentity - // useEffect(() => { - // setIdentity(storeIdentity) - // }, [isEqual(identity, {}) && storedIdentity]) - // const updateIdentity = async () => { - // store.set('identity')(identity) - // } - - // useEffect(() => { - // if (isEqual(storedIdentity, {})) { - // updateIdentity() - // } - // }, []) - - // const validate = useCallback( - // debounce(async (identity, storedIdentity, setIsPristine, setErrors, setIsValid) => { - // if (identity && identity.validate) { - // try { - // const pristine = isEqualWith(storedIdentity, identity, (x, y) => { - // if (typeof x === 'function') { - // return true - // } - // if (['string', 'number'].includes(typeof x)) { - // return y && x.toString() === y.toString() - // } - // return undefined - // }) - // const { isValid, errors } = identity.validate() - - // const { isValid: isValidIndex, errors: errorsIndex } = await userStorage.validateIdentity( - // filterObject(identity) - // ) - // const valid = isValid && isValidIndex - - // setErrors(merge(errors, errorsIndex)) - // setIsValid(valid) - // setIsPristine(pristine) - - // return valid - // } catch (e) { - // log.error('validate identity failed', e, e.message) - // showErrorDialog('Unexpected error while validating identity', e) - // return false - // } - // } - // return false - // }, 500), - // [] - // ) - - //const store = GDStore.useStore() - - //const identity = store.get('identity') const [screenState] = useScreenState(screenProps) const { name } = screenState const verifyText = 'I am verifying my GoodDollar identity.' - // const handleIdentityChange = newUsername => { - // identity[name] = { username: newUsername } - // } - - // const handleSaveButton = () => { - // store.set('identity')(identity) - // return identity[name].username - // } - - // const onIdentitySaved = () => { - // screenProps.pop() - // return identity[name].username - // } return (
diff --git a/src/components/identity/AddIdentityMenu.js b/src/components/identity/AddIdentityMenu.js index 8c58491f01..4b1f78889a 100644 --- a/src/components/identity/AddIdentityMenu.js +++ b/src/components/identity/AddIdentityMenu.js @@ -9,10 +9,6 @@ import { displayNames } from './identities' const TITLE = 'Add Identity' -// function filterObject(obj) { -// return pickBy(obj, (v, k) => v !== undefined && v !== '') -// } - const arrayDiff = (a, b) => { return a.filter(x => !b.includes(x)) } diff --git a/src/components/identity/GenericSocial.js b/src/components/identity/GenericSocial.js index e1303c3d47..77b0bfe0be 100644 --- a/src/components/identity/GenericSocial.js +++ b/src/components/identity/GenericSocial.js @@ -2,17 +2,12 @@ import React from 'react' import { Clipboard, TouchableOpacity } from 'react-native' -//import GDStore from '../../lib/undux/GDStore' import { SaveButton, Section, Text, Wrapper } from '../common' import InputRounded from '../common/form/InputRounded' - -// import InputText from '../common/form/InputText' import { useScreenState } from '../appNavigation/stackNavigation' import { withStyles } from '../../lib/styles' import { displayNames, postNames } from './identities' - import ShareButton from './ShareButton' -GenericSocial const TITLE = 'Add Identity' diff --git a/src/components/identity/ShareButton.js b/src/components/identity/ShareButton.js index a01e1f814c..d0e95acfa5 100644 --- a/src/components/identity/ShareButton.js +++ b/src/components/identity/ShareButton.js @@ -16,12 +16,15 @@ class ShareButton extends Component { if (result.action === Share.sharedAction) { if (result.activityType) { + // TODO: // shared with activity type of result.activityType } else { + // TODO: // shared // NOTHING } } else if (result.action === Share.dismissedAction) { + // TODO: // dismissed } } catch (error) { diff --git a/src/components/profile/EditProfile.js b/src/components/profile/EditProfile.js index a1a5ae9152..5d221ba747 100644 --- a/src/components/profile/EditProfile.js +++ b/src/components/profile/EditProfile.js @@ -3,11 +3,9 @@ import React, { useCallback, useEffect, useState } from 'react' import debounce from 'lodash/debounce' import isEqualWith from 'lodash/isEqualWith' import isEqual from 'lodash/isEqual' - import merge from 'lodash/merge' import pickBy from 'lodash/pickBy' -//import IdentityDataTable from '../identity/IdentityDataTable' import userStorage from '../../lib/gundb/UserStorage' import logger from '../../lib/logger/pino-logger' import GDStore from '../../lib/undux/GDStore'