Skip to content

Commit

Permalink
Rebase app and fix lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbuhl93 committed Jul 6, 2021
1 parent 501a6cd commit ff913f0
Show file tree
Hide file tree
Showing 11 changed files with 272 additions and 606 deletions.
34 changes: 19 additions & 15 deletions app/screens/authentication-screen/authentication-check-screen.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
import * as React from "react"

import { Image } from "react-native"
import EStyleSheet from "react-native-extended-stylesheet"
import { useEffect } from "react"
import { Image } from "react-native"
import EStyleSheet from 'react-native-extended-stylesheet'
import EStyleSheet from "react-native-extended-stylesheet"

import { Screen } from "../../components/screen"
import { palette } from "../../theme/palette"
import KeyStoreWrapper from "../../utils/storage/secureStorage"
import BiometricWrapper from "../../utils/biometricAuthentication"
import type { ScreenType } from '../../types/screen'
import type { ScreenType } from "../../types/screen"
import { AuthenticationScreenPurpose, PinScreenPurpose } from "../../utils/enum"

// eslint-disable-next-line @typescript-eslint/no-var-requires
const BitcoinBeachLogo = require("../get-started-screen/bitcoinBeach3.png")

const styles = EStyleSheet.create({
Logo: {
marginTop: 24,
maxHeight: "50%",
maxWidth: "50%",
},

container: {
alignItems: "center",
flex: 1,
width: "100%",
},

Logo: {
maxHeight: "50%",
maxWidth: "50%",
marginTop: 24,
},
})

type Props = {
Expand All @@ -35,11 +33,17 @@ type Props = {

export const AuthenticationCheckScreen: ScreenType = ({ navigation }: Props) => {
useEffect(() => {
(async () => {
const isPinEnabled = (await KeyStoreWrapper.getIsPinEnabled())
;(async () => {
const isPinEnabled = await KeyStoreWrapper.getIsPinEnabled()

if (await BiometricWrapper.isSensorAvailable() && await KeyStoreWrapper.getIsBiometricsEnabled()) {
navigation.replace("authentication", { screenPurpose: AuthenticationScreenPurpose.Authenticate, isPinEnabled })
if (
(await BiometricWrapper.isSensorAvailable()) &&
(await KeyStoreWrapper.getIsBiometricsEnabled())
) {
navigation.replace("authentication", {
screenPurpose: AuthenticationScreenPurpose.Authenticate,
isPinEnabled,
})
} else if (isPinEnabled) {
navigation.replace("pin", { screenPurpose: PinScreenPurpose.AuthenticatePin })
} else {
Expand Down
47 changes: 26 additions & 21 deletions app/screens/authentication-screen/authentication-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import { Alert, Image, View } from "react-native"
import { Button } from "react-native-elements"
import EStyleSheet from "react-native-extended-stylesheet"
import { useApolloClient } from "@apollo/client"
<<<<<<< HEAD
import RNSecureKeyStore, { ACCESSIBLE } from "react-native-secure-key-store"
=======
>>>>>>> Wrap SecureKeyStore and Biometric utility functions

import { Screen } from "../../components/screen"
import { color } from "../../theme"
Expand All @@ -16,15 +12,22 @@ import { translate } from "../../i18n"
import KeyStoreWrapper from "../../utils/storage/secureStorage"
import BiometricWrapper from "../../utils/biometricAuthentication"
import { resetDataStore } from "../../utils/logout"
import type { ScreenType } from '../../types/screen'
import type { ScreenType } from "../../types/screen"
import { AuthenticationScreenPurpose, PinScreenPurpose } from "../../utils/enum"

// eslint-disable-next-line @typescript-eslint/no-var-requires
const BitcoinBeachLogo = require("../get-started-screen/bitcoinBeach3.png")

const styles = EStyleSheet.create({
Logo: {
marginTop: 24,
maxHeight: "50%",
maxWidth: "50%",
},

bottom: {
flex: 1,
alignItems: "center",
flex: 1,
justifyContent: "flex-end",
marginBottom: 36,
width: "100%",
Expand All @@ -40,6 +43,10 @@ const styles = EStyleSheet.create({
borderRadius: 24,
},

buttonAlternateTitle: {
color: palette.white,
},

buttonContainer: {
marginVertical: 12,
width: "80%",
Expand All @@ -50,21 +57,11 @@ const styles = EStyleSheet.create({
fontWeight: "bold",
},

buttonAlternateTitle: {
color: palette.white,
},

container: {
alignItems: "center",
flex: 1,
width: "100%",
},

Logo: {
maxHeight: "50%",
maxWidth: "50%",
marginTop: 24,
},
})

type Props = {
Expand All @@ -73,8 +70,8 @@ type Props = {
screenPurpose: AuthenticationScreenPurpose
isPinEnabled: boolean
}
},
navigation: any,
}
navigation: any
}

export const AuthenticationScreen: ScreenType = ({ route, navigation }: Props) => {
Expand All @@ -94,7 +91,11 @@ export const AuthenticationScreen: ScreenType = ({ route, navigation }: Props) =
description = translate("AuthenticationScreen.setUpAuthenticationDescription")
}
// Presents the OS specific authentication prompt
BiometricWrapper.authenticate(description, handleAuthenticationSuccess, handleAuthenticationFailure)
BiometricWrapper.authenticate(
description,
handleAuthenticationSuccess,
handleAuthenticationFailure,
)
}

const handleAuthenticationSuccess = () => {
Expand Down Expand Up @@ -132,7 +133,9 @@ export const AuthenticationScreen: ScreenType = ({ route, navigation }: Props) =
title={translate("AuthenticationScreen.usePin")}
buttonStyle={styles.buttonAlternate}
titleStyle={styles.buttonAlternateTitle}
onPress={() => navigation.navigate("pin", { screenPurpose: PinScreenPurpose.AuthenticatePin })}
onPress={() =>
navigation.navigate("pin", { screenPurpose: PinScreenPurpose.AuthenticatePin })
}
containerStyle={styles.buttonContainer}
/>
)
Expand Down Expand Up @@ -179,7 +182,9 @@ export const AuthenticationScreen: ScreenType = ({ route, navigation }: Props) =
title={(() => {
if (screenPurpose === AuthenticationScreenPurpose.Authenticate) {
return translate("AuthenticationScreen.unlock")
} else if (screenPurpose === AuthenticationScreenPurpose.TurnOnAuthentication) {
} else if (
screenPurpose === AuthenticationScreenPurpose.TurnOnAuthentication
) {
return translate("AuthenticationScreen.setUp")
} else {
return ""
Expand Down
Loading

0 comments on commit ff913f0

Please sign in to comment.