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

chore(native-app): Remove old feature flags from app #16406

Merged
merged 3 commits into from
Oct 18, 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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { NavigationFunctionComponent } from 'react-native-navigation'
import styled from 'styled-components/native'
import IconStatusVerified from '../../assets/icons/valid.png'
import IconStatusNonVerified from '../../assets/icons/warning.png'
import { useFeatureFlag } from '../../contexts/feature-flag-provider'
import { useGetIdentityDocumentQuery } from '../../graphql/types/schema'
import { createNavigationOptionHooks } from '../../hooks/create-navigation-option-hooks'
import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator'
Expand Down Expand Up @@ -94,10 +93,6 @@ export const WalletPassportScreen: NavigationFunctionComponent<{
useNavigationOptions(componentId)
useConnectivityIndicator({ componentId })
const { openBrowser } = useBrowser()
const showChildrenPassport = useFeatureFlag(
'isChildrenPassportEnabled',
false,
)

const intl = useIntl()
const { data, loading, error } = useGetIdentityDocumentQuery({
Expand Down Expand Up @@ -217,7 +212,7 @@ export const WalletPassportScreen: NavigationFunctionComponent<{
/>
</InputRow>

{showChildrenPassport && childrenPassport?.length > 0 ? (
{childrenPassport?.length > 0 ? (
<View style={{ paddingHorizontal: 16, marginTop: 8 }}>
<Label>
{intl.formatMessage({ id: 'walletPassport.children' })}
Expand Down
37 changes: 8 additions & 29 deletions apps/native/app/src/screens/wallet/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { useNavigationComponentDidAppear } from 'react-native-navigation-hooks'

import illustrationSrc from '../../assets/illustrations/le-retirement-s3.png'
import { BottomTabsIndicator } from '../../components/bottom-tabs-indicator/bottom-tabs-indicator'
import { useFeatureFlag } from '../../contexts/feature-flag-provider'
import {
GenericLicenseType,
GenericUserLicense,
Expand All @@ -30,7 +29,6 @@ import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator
import { usePreferencesStore } from '../../stores/preferences-store'
import { isIos } from '../../utils/devices'
import { getRightButtons } from '../../utils/get-main-root'
import { isDefined } from '../../utils/is-defined'
import { testIDs } from '../../utils/test-ids'
import { WalletItem } from './components/wallet-item'

Expand Down Expand Up @@ -100,13 +98,6 @@ export const WalletScreen: NavigationFunctionComponent = ({ componentId }) => {
const { dismiss, dismissed } = usePreferencesStore()
const [hiddenContent, setHiddenContent] = useState(isIos)

// Feature flags
const showPassport = useFeatureFlag('isPassportEnabled', false)
const showDisability = useFeatureFlag('isDisabilityFlagEnabled', false)
const showPCard = useFeatureFlag('isPCardEnabled', false)
const showEhic = useFeatureFlag('isEhicEnabled', false)
const showHuntingLicense = useFeatureFlag('isHuntingLicenseEnabled', false)

// Query list of licenses
const res = useListLicensesQuery({
variables: {
Expand All @@ -116,11 +107,11 @@ export const WalletScreen: NavigationFunctionComponent = ({ componentId }) => {
GenericLicenseType.AdrLicense,
GenericLicenseType.MachineLicense,
GenericLicenseType.FirearmLicense,
showDisability ? GenericLicenseType.DisabilityLicense : null,
showPCard ? GenericLicenseType.PCard : null,
showEhic ? GenericLicenseType.Ehic : null,
showHuntingLicense ? GenericLicenseType.HuntingLicense : null,
].filter(isDefined),
GenericLicenseType.DisabilityLicense,
GenericLicenseType.PCard,
GenericLicenseType.Ehic,
GenericLicenseType.HuntingLicense,
],
},
},
})
Expand All @@ -142,24 +133,12 @@ export const WalletScreen: NavigationFunctionComponent = ({ componentId }) => {
if (license.status === 'Unknown') {
return false
}
if (license.type === GenericLicenseType.DisabilityLicense) {
return showDisability
}
if (license.type === GenericLicenseType.PCard) {
return showPCard
}
if (license.type === GenericLicenseType.Ehic) {
return showEhic
}
if (license.type === GenericLicenseType.HuntingLicense) {
return showHuntingLicense
}
return true
})
}

return []
}, [res, showDisability, showPCard, showEhic, showHuntingLicense])
}, [res])

// indexing list for spotlight search IOS
useEffect(() => {
Expand Down Expand Up @@ -245,9 +224,9 @@ export const WalletScreen: NavigationFunctionComponent = ({ componentId }) => {

return [
...licenseItems,
...(showPassport ? resPassport?.data?.getIdentityDocument ?? [] : []),
...(resPassport?.data?.getIdentityDocument ?? []),
] as FlatListItem[]
}, [licenseItems, resPassport, showPassport, res.loading, res.data])
}, [licenseItems, resPassport, res.loading, res.data])

// Fix for a bug in react-native-navigation where the large title is not visible on iOS with bottom tabs https://github.com/wix/react-native-navigation/issues/6717
if (hiddenContent) {
Expand Down