Skip to content

Commit

Permalink
added extra field
Browse files Browse the repository at this point in the history
  • Loading branch information
milon27 committed Jul 24, 2021
1 parent 58303d6 commit 66384b1
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 23 deletions.
Binary file modified assets/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions src/components/layouts/modal/PasswordModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ export default function PasswordModal({ open, setOpen, item }) {
return (
<MModal title="Password Details" open={open || false} setOpen={setOpen} onSubmit={onSubmit} submitText="Delete Password" cancelText="Edit" onCancel={onEdit}>
<Text style={styles.text}>Site: {item?.title} </Text>
<Text style={styles.text}>URL: {item?.url} </Text>
<Text style={styles.text}>Username: {item?.username} </Text>
<Text style={styles.text}>Email: {item?.email}</Text>
<Text selectable={true} style={styles.text}>URL: {item?.url} </Text>
<Text selectable={true} style={styles.text}>Username: {item?.username} </Text>
<Text selectable={true} style={styles.text}>Email: {item?.email}</Text>
<Text selectable={true} style={styles.text}>Password: {pass}</Text>
{item?.other.length > 0 ? <Text selectable={true} style={styles.text}>Other Info: {item?.other}</Text> : null}

</MModal>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/navigation/AppNavContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function AppNavContainer() {
<>
<UserInactivity
isActive={active}
timeForInactivity={24000}
timeForInactivity={60000}
onAction={(a) => {
setactive(a)
}}
Expand Down
4 changes: 3 additions & 1 deletion src/components/navigation/DrawerContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ const styles = StyleSheet.create({
marginTop: 20,
alignSelf: "flex-start",
borderRadius: 50,
backgroundColor: Theme.COLOR_PRIMARY,
borderWidth: 1,
borderColor: Theme.COLOR_PRIMARY,
backgroundColor: Theme.COLOR_WHITE,
padding: 10
},
container: {
Expand Down
4 changes: 2 additions & 2 deletions src/components/screens/auth/SignIn.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ export default function SignIn() {

<ResponseLayout response={app.response} />

<Input autoCapitalize={'none'} icon={<Icon type={DefineIcon.MaterialIcon} size={17} name="alternate-email" />} value={input.email} error={error?.email} onChangeText={(text) => Helper.onChange({ name: N_EMAIL, value: text, setInput: setInput, setError: setError })} label="Enter Your Email" />
<Input autoCapitalize={'none'} icon={<Icon type={DefineIcon.MaterialIcon} size={17} name="alternate-email" />} value={input.email} error={error?.email} onChangeText={(text) => Helper.onChange({ name: N_EMAIL, value: text, setInput: setInput, setError: setError, required: true })} label="Enter Your Email" />

<Input icon={<Icon type={DefineIcon.Feather} size={17} name="lock" />} value={input.password} error={error?.password} onChangeText={(text) => Helper.onChange({ name: N_PASSWORD, value: text, setInput: setInput, setError: setError })} type="password" label="Enter Password" />
<Input icon={<Icon type={DefineIcon.Feather} size={17} name="lock" />} value={input.password} error={error?.password} onChangeText={(text) => Helper.onChange({ name: N_PASSWORD, value: text, setInput: setInput, setError: setError, required: true })} type="password" label="Enter Password" />


<MButton title="Login Now" loading={app?.loading} color={Theme.COLOR_PRIMARY} onPress={onSubmit} disabled={app?.loading} />
Expand Down
8 changes: 4 additions & 4 deletions src/components/screens/auth/SignUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,19 @@ export default function SignUp() {
<Input value={input.email}
icon={<Icon type={DefineIcon.MaterialIcon} size={17} name="alternate-email" />}
error={error?.email}
onChangeText={(text) => Helper.onChange({ name: N_EMAIL, value: text, setInput: setInput, setError: setError })} label="Enter Your Email" />
onChangeText={(text) => Helper.onChange({ name: N_EMAIL, value: text, setInput: setInput, setError: setError, required: true })} label="Enter Your Email" />

<Input value={input.name} error={error?.name}
icon={<Icon type={DefineIcon.Feather} size={17} name="user" />}
onChangeText={(text) => Helper.onChange({ name: N_NAME, value: text, setInput: setInput, setError: setError })} label="Enter Your Name" />
onChangeText={(text) => Helper.onChange({ name: N_NAME, value: text, setInput: setInput, setError: setError, required: true })} label="Enter Your Name" />

<Input value={input[N_PASSWORD]} error={error[N_PASSWORD]}
icon={<Icon type={DefineIcon.Feather} size={17} name="lock" />}
onChangeText={(text) => Helper.onChange({ name: N_PASSWORD, value: text, setInput: setInput, setError: setError })} type="password" label="Enter Master Password" />
onChangeText={(text) => Helper.onChange({ name: N_PASSWORD, value: text, setInput: setInput, setError: setError, required: true })} type="password" label="Enter Master Password" />

<Input value={input[N_C_PASSWORD]} error={error[N_C_PASSWORD]}
icon={<Icon type={DefineIcon.Feather} size={17} name="lock" />}
onChangeText={(text) => Helper.onChange({ name: N_C_PASSWORD, value: text, setInput: setInput, setError: setError })} type="password" label="Confirm Master Password" />
onChangeText={(text) => Helper.onChange({ name: N_C_PASSWORD, value: text, setInput: setInput, setError: setError, required: true })} type="password" label="Confirm Master Password" />

<MButton title="Sign Up Now" loading={app?.loading} color={Theme.COLOR_PRIMARY} onPress={onSubmit} disabled={app?.loading} />
{/* while loading.. it should be disabled */}
Expand Down
22 changes: 13 additions & 9 deletions src/components/screens/dashboard/CreatePassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default function CreatePassword({ route: { params }, navigation }) {
const N_EMAIL = "email"
const N_USERNAME = "username"
const N_USER = "user"
const N_OTHER = "other"
const N_CAT = "category"
const N_IS_FAV = "is_fav"

Expand All @@ -44,6 +45,7 @@ export default function CreatePassword({ route: { params }, navigation }) {
[N_EMAIL]: item[N_EMAIL] || "",
[N_USERNAME]: item[N_USERNAME] || "",
[N_PASSWORD]: "",
[N_OTHER]: item[N_OTHER] || "",
[N_USER]: item[N_USER] || "",
[N_IS_FAV]: item[N_IS_FAV] || false,
} : {
Expand All @@ -52,6 +54,7 @@ export default function CreatePassword({ route: { params }, navigation }) {
[N_EMAIL]: "",
[N_USERNAME]: "",
[N_PASSWORD]: "",
[N_OTHER]: "",
[N_USER]: "",
[N_IS_FAV]: false,
}
Expand All @@ -61,15 +64,13 @@ export default function CreatePassword({ route: { params }, navigation }) {
[N_EMAIL]: "",
[N_USERNAME]: "",
[N_PASSWORD]: "",
[N_OTHER]: "",
[N_USER]: "",
[N_IS_FAV]: false,
}

const error_init = {
[N_TITLE]: "",
[N_URL]: "",
[N_EMAIL]: "",
[N_USERNAME]: "",
[N_PASSWORD]: "",
}
const [cat, setCat] = useState([])
Expand Down Expand Up @@ -115,9 +116,6 @@ export default function CreatePassword({ route: { params }, navigation }) {
//validation
const errorArray = Helper.validateObject({
[N_TITLE]: input[N_TITLE],
[N_URL]: input[N_URL],
[N_EMAIL]: input[N_EMAIL],
[N_USERNAME]: input[N_USERNAME],
[N_PASSWORD]: input[N_PASSWORD]
})
errorArray.forEach(item => {
Expand Down Expand Up @@ -177,7 +175,7 @@ export default function CreatePassword({ route: { params }, navigation }) {
ref={titleRef}
icon={<Icon type={DefineIcon.Feather} size={17} name="feather" />}
label="Enter Password Title"
onChangeText={(text) => Helper.onChange({ name: N_TITLE, value: text, setInput, setError })}
onChangeText={(text) => Helper.onChange({ name: N_TITLE, value: text, setInput, setError, required: true })}
nextRef={urlRef}
/>
<Input autoCapitalize={'none'} value={input[N_URL]} error={error[N_URL]}
Expand Down Expand Up @@ -215,8 +213,8 @@ export default function CreatePassword({ route: { params }, navigation }) {
value={input[N_PASSWORD]}
error={error[N_PASSWORD]}
icon={<Icon type={DefineIcon.Feather} size={17} name="lock" />}
label="Enter Site Password"
onChangeText={(text) => Helper.onChange({ name: N_PASSWORD, value: text, setInput, setError })}
label="Enter Site Password / PIN"
onChangeText={(text) => Helper.onChange({ name: N_PASSWORD, value: text, setInput, setError, required: true })}
/>

<View style={styles.justifyRow}>
Expand Down Expand Up @@ -260,6 +258,12 @@ export default function CreatePassword({ route: { params }, navigation }) {
zIndexInverse={3000}
/>

<Input
autoCapitalize={'none'} value={input[N_OTHER]} error={error[N_OTHER]}
icon={<Icon type={DefineIcon.Feather} size={17} name="credit-card" />}
label="Other Important Information"
onChangeText={(text) => Helper.onChange({ name: N_OTHER, value: text, setInput, setError })}
/>


<MButton style={{ elevation: 0 }} title={item ? "Update Now" : "Create New"} loading={app?.loading} color={Theme.COLOR_PRIMARY} onPress={onSubmit} disabled={app?.loading} />
Expand Down
2 changes: 1 addition & 1 deletion src/components/screens/dashboard/SingleRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function SingleRow({ item }) {
</View> */}

<View>
<Text style={{ color: Theme.COLOR_BLACK, fontWeight: "bold" }}>{item?.url}</Text>
<Text style={{ color: Theme.COLOR_BLACK, fontWeight: "bold" }}>{item?.title}</Text>
<Text style={{ color: Theme.COLOR_BLACK, fontSize: 12 }}>{item?.email}</Text>
</View>
</View>
Expand Down
8 changes: 6 additions & 2 deletions src/utils/helpers/Helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@ const Helper = {
alert(msg)
}
},//Toast
onChange: ({ name, value, setInput, setError }) => {
onChange: ({ name, value, setInput, setError, required = false }) => {
setInput((input) => ({ ...input, [name]: value }))
//check error & remove error
if (value !== "") {
setError((pre) => ({ ...pre, [name]: "" }))
} else {
setError((pre) => ({ ...pre, [name]: "This field is required" }))
if (required === true) {
setError((pre) => ({ ...pre, [name]: "This field is required" }))
} else {
setError((pre) => ({ ...pre, [name]: "" }))
}
}
},
ramdomColor: () => {
Expand Down

0 comments on commit 66384b1

Please sign in to comment.