Skip to content

Commit

Permalink
Merge pull request #717 from artsy/main
Browse files Browse the repository at this point in the history
[pull] main from artsy:main
  • Loading branch information
pull[bot] committed Jun 5, 2024
2 parents 8341328 + 349835f commit 02df20d
Show file tree
Hide file tree
Showing 33 changed files with 330 additions and 291 deletions.
14 changes: 14 additions & 0 deletions data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2336,6 +2336,7 @@ type Artwork implements Node & Searchable & Sellable {

# Returns the display label and detail when artwork has a certificate of authenticity
certificateOfAuthenticity: ArtworkInfoRow
certificateOfAuthenticityDetails: CertificateOfAuthenticityDetails
collectingInstitution: String
collectionsConnection(
after: String
Expand Down Expand Up @@ -3982,6 +3983,11 @@ type CausalityLotState {
soldStatus: String
}

type CertificateOfAuthenticityDetails {
coaByAuthenticatingBody: Boolean
coaByGallery: Boolean
}

type Channel {
# A connection of articles related to a partner.
articlesConnection(
Expand Down Expand Up @@ -13528,6 +13534,8 @@ input MyCollectionCreateArtworkInput {
attributionClass: ArtworkAttributionClassType
category: String
clientMutationId: String
coaByAuthenticatingBody: Boolean
coaByGallery: Boolean

# The given location of the user as structured data
collectorLocation: EditableLocation
Expand All @@ -13545,6 +13553,7 @@ input MyCollectionCreateArtworkInput {
framedHeight: String
framedMetric: String
framedWidth: String
hasCertificateOfAuthenticity: Boolean
height: String
importSource: ArtworkImportSource
isEdition: Boolean
Expand Down Expand Up @@ -13625,6 +13634,8 @@ input MyCollectionUpdateArtworkInput {
attributionClass: ArtworkAttributionClassType
category: String
clientMutationId: String
coaByAuthenticatingBody: Boolean
coaByGallery: Boolean

# The given location of the user as structured data
collectorLocation: EditableLocation
Expand All @@ -13642,6 +13653,7 @@ input MyCollectionUpdateArtworkInput {
framedHeight: String
framedMetric: String
framedWidth: String
hasCertificateOfAuthenticity: Boolean
height: String
isEdition: Boolean
isFramed: Boolean
Expand Down Expand Up @@ -15676,6 +15688,7 @@ type Query {
artworksForUser(
after: String
before: String
excludeArtworkIds: [String] = []
excludeDislikedArtworks: Boolean = false
first: Int
includeBackfill: Boolean!
Expand Down Expand Up @@ -20612,6 +20625,7 @@ type Viewer {
artworksForUser(
after: String
before: String
excludeArtworkIds: [String] = []
excludeDislikedArtworks: Boolean = false
first: Int
includeBackfill: Boolean!
Expand Down
2 changes: 1 addition & 1 deletion docs/deploy_a_hotfix.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Test that the fix is working as intended and do some basic QA to make sure the a
If QA goes well run the script to promote the bundle to production.
Make sure to monitor the app as it rolls out to users.

`./scripts/codepush/promote-release-to-prod.sh <rollout_percentage>`
`./scripts/codepush/promote-to-prod.sh <rollout_percentage>`

For example if you wanted to rollout to 50% of users you would pass `50` for rollout_percentage. If it is critical to get the fix out fast
you can pass `100` otherwise it is suggested you pass `50` and monitor before updating to 100%.
Expand Down
10 changes: 9 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ lane :deploy_to_codepush do |options|
api_token: ENV['APP_CENTER_API_TOKEN'],
owner_name: 'mobile-artsy',
app_name: app_name,
description: "'#{description}'",
description: "#{description} version:#{release_version}",
deployment: deployment_name,
sourcemap_output: sourcemap_output,
output_dir: './build',
Expand Down Expand Up @@ -496,6 +496,14 @@ lane :promote_codepush do |options|
sourceDeployment = 'Canary'
targetDeployment = 'Production'

submission_tag = sh("./scripts/codepush/get-submission-tag.sh")

if submission_tag && !submission_tag.empty?
tag_and_push(tag: submission_tag)
else
UI.warn("Submission tag could not be added! Please add one yourself so we can find the release code!")
end

# Promote to prod with rollout percentage, make it mandatory
sh("appcenter codepush promote -a #{androidAppName} -s #{sourceDeployment} -d #{targetDeployment} -r #{rolloutPercentage} --mandatory")
sh("appcenter codepush promote -a #{iosAppName} -s #{sourceDeployment} -d #{targetDeployment} -r #{rolloutPercentage} --mandatory")
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
},
"dependencies": {
"@artsy/cohesion": "4.184.0",
"@artsy/palette-mobile": "13.2.9",
"@artsy/palette-mobile": "13.2.12",
"@artsy/to-title-case": "1.1.0",
"@expo/react-native-action-sheet": "4.0.1",
"@gorhom/bottom-sheet": "4.5.1",
Expand Down
13 changes: 13 additions & 0 deletions scripts/codepush/get-submission-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail

# fetch the latest description from the deployment history the naming patern is "some description version:codepush-canary-ios-8.39.0-2024.05.10.09
description=$(appcenter codepush deployment history -a mobile-artsy/Eigen Canary --output json | jq '.[-1][4]')

# extract the version from the description
if [[ $description =~ version:(.*) ]]; then
extracted_string="${BASH_REMATCH[1]}"
modified_string="${extracted_string//staging/submission}"
modified_string="${modified_string//canary/submission}"
echo "$modified_string"
fi
6 changes: 4 additions & 2 deletions src/app/AppRegistry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -654,15 +654,17 @@ export const modules = defineModules({
SubmitArtwork: unsafe_getFeatureFlag("AREnableNewSubmissionFlow")
? reactModule(SubmitArtworkForm, {
hidesBackButton: true,
hidesBottomTabs: true,
alwaysPresentModally: true,
modalPresentationStyle: "fullScreen",
screenOptions: {
gestureEnabled: false,
},
})
: reactModule(SubmitArtwork, { hidesBackButton: true, hidesBottomTabs: true }),
SubmitArtworkEdit: reactModule(SubmitArtworkFormEdit, {
hidesBackButton: true,
hidesBottomTabs: true,
alwaysPresentModally: true,
modalPresentationStyle: "fullScreen",
screenOptions: {
gestureEnabled: false,
},
Expand Down
3 changes: 3 additions & 0 deletions src/app/Components/Select/Components/SelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const SelectModal: React.FC<{
onSelectValue(value: unknown, index: number): any
renderItemLabel?(value: SelectOption<unknown>): JSX.Element
onModalFinishedClosing?(): void
testID?: string
}> = ({
options,
value,
Expand All @@ -36,6 +37,7 @@ export const SelectModal: React.FC<{
onSelectValue,
renderItemLabel,
onModalFinishedClosing,
testID,
}) => {
const color = useColor()

Expand Down Expand Up @@ -123,6 +125,7 @@ export const SelectModal: React.FC<{
onBackgroundPressed={onDismiss}
maxHeight={maxHeight}
onModalFinishedClosing={onModalFinishedClosing}
testID={testID}
>
<Flex p={2} pb="15px" flexDirection="row" alignItems="center" flexGrow={0}>
<Flex flex={1} />
Expand Down
1 change: 1 addition & 0 deletions src/app/Components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const Select = <ValueType,>({
<SelectModal
visible={showingModal}
title={title}
testID={`modal-${testID}`}
enableSearch={enableSearch}
value={value}
options={options}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,14 @@ describe("SubmitArtworkAddDetails", () => {
expect(yearInput.props.value).toBe("2024")

const mediumPicker = screen.getByTestId("CategorySelect")
expect(mediumPicker).toBeOnTheScreen()
fireEvent.press(mediumPicker)
// Wait for the select modal to show up
await flushPromiseQueue()
fireEvent.press(screen.getByText("Painting"))
// Wait for the select modal to dismiss
await flushPromiseQueue()
expect(screen.getByText("Painting")).toBeOnTheScreen()
})

describe("Year input", () => {
it("Hides input when the user taps on I don't know", async () => {
renderWithSubmitArtworkWrapper({
component: <SubmitArtworkAddDetails />,
})

const yearInput = screen.getByTestId("Submission_YearInput")
fireEvent.changeText(yearInput, "2024")
expect(yearInput.props.value).toBe("2024")

const iDontKnowButton = screen.getByText("I don't know")
fireEvent.press(iDontKnowButton)
await flushPromiseQueue()
expect(yearInput.props.value).toBe("")
})

it("Injects the previous value after deselecting I don't know", async () => {
renderWithSubmitArtworkWrapper({
component: <SubmitArtworkAddDetails />,
})

const yearInput = screen.getByTestId("Submission_YearInput")
fireEvent.changeText(yearInput, "2024")
expect(yearInput.props.value).toBe("2024")

const iDontKnowButton = screen.getByText("I don't know")
fireEvent.press(iDontKnowButton)
await flushPromiseQueue()
expect(yearInput.props.value).toBe("")

fireEvent.press(iDontKnowButton)
await flushPromiseQueue()
expect(yearInput.props.value).toBe("2024")
})
const materialsInput = screen.getByTestId("Submission_MaterialsInput")
expect(materialsInput).toBeOnTheScreen()
fireEvent.changeText(materialsInput, "Whatever")
expect(materialsInput.props.value).toBe("Whatever")
})
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Checkbox, Flex, Input, Join, Spacer, Text } from "@artsy/palette-mobile"
import { Flex, Input, Join, Spacer, Text } from "@artsy/palette-mobile"
import { SelectOption } from "app/Components/Select"
import { CategoryPicker } from "app/Scenes/MyCollection/Screens/ArtworkForm/Components/CategoryPicker"
import { ArtworkDetailsFormModel } from "app/Scenes/SellWithArtsy/ArtworkForm/Utils/validation"
Expand All @@ -7,23 +7,20 @@ import {
acceptableCategoriesForSubmission,
} from "app/Scenes/SellWithArtsy/SubmitArtwork/ArtworkDetails/utils/acceptableCategoriesForSubmission"
import { useFormikContext } from "formik"
import { useRef, useState } from "react"
import { useRef } from "react"
import { ScrollView } from "react-native"

export const SubmitArtworkAddDetails = () => {
const [oldTypedYear, setOldTypedYear] = useState("")

const { handleChange, setFieldValue, values, setValues } =
useFormikContext<ArtworkDetailsFormModel>()
const { handleChange, setFieldValue, values } = useFormikContext<ArtworkDetailsFormModel>()

const categories = useRef<Array<SelectOption<AcceptableCategoryValue>>>(
acceptableCategoriesForSubmission()
).current

return (
<Flex px={2}>
<Flex px={2} flex={1}>
<ScrollView>
<Text variant="lg" mb={2}>
<Text variant="lg-display" mb={2}>
Artwork details
</Text>

Expand All @@ -37,33 +34,9 @@ export const SubmitArtworkAddDetails = () => {
value={values.year}
onChangeText={(e) => setFieldValue("year", e)}
accessibilityLabel="Year"
disabled={!!values.isYearUnknown}
style={{ width: "50%" }}
autoFocus
/>
<Spacer y={1} />

<Checkbox
checked={!!values.isYearUnknown}
onPress={() => {
// Save the old typed year to restore it if the user unchecks the checkbox
if (!values.isYearUnknown) {
setOldTypedYear(values.year)
setValues({
...values,
year: "",
isYearUnknown: true,
})
} else {
setValues({
...values,
year: oldTypedYear,
isYearUnknown: false,
})
}
}}
text={<Text color="black60">I don't know</Text>}
/>
<Spacer y={1} />
</Flex>

<CategoryPicker<AcceptableCategoryValue | null>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const SubmitArtworkAddDimensions = () => {

return (
<Flex px={2}>
<Text variant="lg" mb={2}>
<Text variant="lg-display" mb={2}>
Artwork dimensions
</Text>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const SubmitArtworkAddPhoneNumber = () => {
return (
<Flex px={2}>
<ScrollView>
<Text variant="lg" mb={2}>
<Text variant="lg-display" mb={2}>
Add phone number
</Text>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const SubmitArtworkAddPhotos = () => {
const { values } = useFormikContext<ArtworkDetailsFormModel>()

return (
<Flex px={2}>
<Flex px={2} flex={1}>
<ScrollView
contentContainerStyle={{ paddingBottom: 80 }}
showsVerticalScrollIndicator={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export const SubmitArtworkAddTitle = () => {
return (
<Flex px={2}>
<Flex>
{!!values.artistSearchResult && <ArtistSearchResult result={values.artistSearchResult} />}
<Text variant="lg-display">Add artwork title</Text>

<Spacer y={2} />

<Text variant="lg" mb={2}>
Add artwork title
</Text>
{!!values.artistSearchResult && <ArtistSearchResult result={values.artistSearchResult} />}

<Spacer y={2} />

<Input
placeholder="Artwork Title"
Expand Down
Loading

0 comments on commit 02df20d

Please sign in to comment.