Skip to content

Commit

Permalink
chore: file rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Burtey committed Jul 17, 2023
1 parent cab4080 commit 0ecb4e8
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 150 deletions.
4 changes: 2 additions & 2 deletions .storybook/storybook.requires.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const getStories = () => {
"./app/screens/get-started-screen/device-account-fail-modal.stories.tsx": require("../app/screens/get-started-screen/device-account-fail-modal.stories.tsx"),
"./app/screens/get-started-screen/get-started-screen.stories.tsx": require("../app/screens/get-started-screen/get-started-screen.stories.tsx"),
"./app/screens/home-screen/home-screen.stories.tsx": require("../app/screens/home-screen/home-screen.stories.tsx"),
"./app/screens/phone-auth-screen/phone-flow.stories.tsx": require("../app/screens/phone-auth-screen/phone-flow.stories.tsx"),
"./app/screens/phone-auth-screen/phone-validation.stories.tsx": require("../app/screens/phone-auth-screen/phone-validation.stories.tsx"),
"./app/screens/phone-auth-screen/phone-login-flow.stories.tsx": require("../app/screens/phone-auth-screen/phone-login-flow.stories.tsx"),
"./app/screens/phone-auth-screen/phone-login-validation.stories.tsx": require("../app/screens/phone-auth-screen/phone-login-validation.stories.tsx"),
"./app/screens/receive-bitcoin-screen/receive-wrapper.stories.tsx": require("../app/screens/receive-bitcoin-screen/receive-wrapper.stories.tsx"),
"./app/screens/redeem-lnurl-withdrawal-screen/redeem-bitcoin-detail-screen.stories.tsx": require("../app/screens/redeem-lnurl-withdrawal-screen/redeem-bitcoin-detail-screen.stories.tsx"),
"./app/screens/redeem-lnurl-withdrawal-screen/redeem-bitcoin-result-screen.stories.tsx": require("../app/screens/redeem-lnurl-withdrawal-screen/redeem-bitcoin-result-screen.stories.tsx"),
Expand Down
118 changes: 0 additions & 118 deletions app/screens/phone-auth-screen/badger-phone-01.svg

This file was deleted.

4 changes: 2 additions & 2 deletions app/screens/phone-auth-screen/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./phone-validation"
export * from "./phone-input"
export * from "./phone-login-validation"
export * from "./phone-login-input"
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meta } from "@storybook/react"
import { MockedProvider } from "@apollo/client/testing"
import { createCache } from "../../graphql/cache"
import { StoryScreen } from "../../../.storybook/views"
import { PhoneValidationScreen } from "./phone-validation"
import { PhoneValidationScreen } from "./phone-registration-validation"

const mocks = []

Expand Down
19 changes: 8 additions & 11 deletions app/screens/phone-auth-screen/useRequestPhoneCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const ErrorType = {
UnsupportedCountryError: "UnsupportedCountryError",
} as const

import axios from "axios"

type ErrorType = (typeof ErrorType)[keyof typeof ErrorType]

export type RequestPhoneCodeStatus =
Expand Down Expand Up @@ -144,8 +146,12 @@ export const useRequestPhoneCode = ({
const getCountryCodeFromIP = async () => {
let defaultCountryCode = "SV" as CountryCode
try {
const response = (await fetchWithTimeout("https://ipapi.co/json/")) as Response
const data = await response.json()
const response = await axios({
method: "get",
url: "https://ipapi.co/json/",
timeout: 5000,
})
const data = response.data

if (data && data.country_code) {
const countryCode = data.country_code
Expand Down Expand Up @@ -308,12 +314,3 @@ export const useRequestPhoneCode = ({
loadingSupportedCountries,
}
}

const fetchWithTimeout = (url: string, timeout = 5000) => {
return Promise.race([
fetch(url),
new Promise((_, reject) => {
setTimeout(() => reject(new Error("request timed out")), timeout)
}),
])
}
21 changes: 5 additions & 16 deletions app/screens/settings-screen/account-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,23 +400,12 @@ export const AccountScreen = () => {
id: "phone",
icon: "call-outline",
subTitleText: phoneNumber,
action: () => {},
enabled: false,
greyed: true,
hidden: !isAtLeastLevelOne,
},
{
category: LL.AccountScreen.removePhone(),
id: "remove-phone",
icon: "trash-outline",
subTitleText: emailAndPhoneActivated ? undefined : LL.AccountScreen.addEmailFirst(),
action: deletePhonePrompt,
enabled: emailAndPhoneActivated,
greyed: !emailAndPhoneActivated,
chevron: false,
styleDivider: true,
hidden: true,
// hidden: !email,
chevronLogo: emailAndPhoneActivated ? "close-circle-outline" : undefined,
chevronColor: emailAndPhoneActivated ? colors.red : undefined,
chevronSize: emailAndPhoneActivated ? 28 : undefined,
hidden: !isAtLeastLevelOne,
},

{
Expand Down Expand Up @@ -464,7 +453,7 @@ export const AccountScreen = () => {
accountSettingsList.push({
category: LL.support.deleteAccount(),
id: "deleteAccount",
icon: "close-circle-outline",
icon: "trash-outline",
dangerous: true,
action: deleteAccountAction,
enabled: true,
Expand Down

0 comments on commit 0ecb4e8

Please sign in to comment.