Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(DIA-981)(DIA-937): Auth2 QA Omnibus (Continued) #11083

Merged
merged 5 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions src/app/Scenes/Onboarding/Auth2/hooks/useCountryCode.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
import { useCountryCodeQuery } from "__generated__/useCountryCodeQuery.graphql"
import { useClientQuery } from "app/utils/useClientQuery"
import { useEffect, useState } from "react"
import { getIpAddress } from "react-native-device-info"
import { graphql } from "react-relay"

const USE_COUNTRY_CODE_QUERY = graphql`
query useCountryCodeQuery($ip: String!) {
requestLocation(ip: $ip) {
query useCountryCodeQuery {
requestLocation {
countryCode
}
}
`

export const useCountryCode = () => {
const [ip, setIp] = useState("0.0.0.0")

useEffect(() => {
getIpAddress().then((ip) => {
setIp(ip)
})
}, [])

const { data, loading, error } = useClientQuery<useCountryCodeQuery>({
query: USE_COUNTRY_CODE_QUERY,
variables: {
ip,
},
cacheConfig: {
networkCacheConfig: {
force: false,
Expand Down
32 changes: 14 additions & 18 deletions src/app/Scenes/Onboarding/Auth2/scenes/LoginWelcomeStep.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import {
AppleIcon,
BackButton,
Button,
FacebookIcon,
Flex,
GoogleIcon,
Input,
LinkText,
Spacer,
Expand All @@ -21,7 +24,7 @@ import { osMajorVersion } from "app/utils/platformUtil"
import { Formik, useFormikContext } from "formik"
import { MotiView } from "moti"
import React, { useRef } from "react"
import { Image, Platform } from "react-native"
import { Platform } from "react-native"
import { Easing } from "react-native-reanimated"
import * as Yup from "yup"

Expand Down Expand Up @@ -225,30 +228,23 @@ const SocialLoginButtons: React.FC = () => {

<Spacer y={1} />

<Flex flexDirection="row" justifyContent="space-evenly" width="100%">
<Flex flexDirection="row" gap={1} justifyContent="center" width="100%">
{Platform.OS === "ios" && osMajorVersion() >= 13 && (
<Button variant="fillDark" width="100%" onPress={handleApplePress}>
<Flex height="100%" justifyContent="center" alignItems="center">
<Image source={require("images/apple.webp")} />
<Button variant="outline" onPress={handleApplePress}>
<Flex alignItems="center" justifyContent="center">
{/* On iOS, the icons need to be nudged down to be centered in the button. */}
<AppleIcon width={23} height={23} style={{ top: 4 }} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's iOS only, then shouldn't we check the platform here too as we do in the other icons?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because we only show the Apple option on iOS, so it would be redundant to add the check here.

</Flex>
</Button>
)}

<Button variant="outline" onPress={handleGooglePress}>
<Flex justifyContent="center" alignItems="center">
<Image
source={require("images/google.webp")}
style={{ position: "relative", top: 2 }}
/>
<Flex alignItems="center" justifyContent="center">
<GoogleIcon width={23} height={23} style={Platform.OS === "ios" && { top: 4 }} />
</Flex>
</Button>

<Button variant="outline" width="100%" onPress={handleFacebookPress}>
<Flex justifyContent="center" alignItems="center">
<Image
source={require("images/facebook.webp")}
style={{ position: "relative", top: 2 }}
/>
<Button variant="outline" onPress={handleFacebookPress}>
<Flex alignItems="center" justifyContent="center">
<FacebookIcon width={23} height={23} style={Platform.OS === "ios" && { top: 4 }} />
</Flex>
</Button>
</Flex>
Expand Down
9 changes: 1 addition & 8 deletions src/app/utils/auth/socialSignInHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,10 @@ export const useSocialLogin = () => {
) => {
if (errorMode === "no account") {
Alert.alert("No Artsy account found", error.message, [
{
text: "Cancel",
style: "cancel",
},
{
text: "OK",
onPress: () => {
// TODO: How should this be handled in auth2?
// navigation.replace(mode === "login" ? "OnboardingCreateAccount" : "OnboardingLogin", {
// withFadeAnimation: true,
// })
captureMessage("AUTH_BLOCKED: " + error.message)
},
},
])
Expand Down