Skip to content

Commit

Permalink
Remove extra dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jorelosorio committed Feb 17, 2025
1 parent 9ea72ce commit 92d409e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@ import {
} from '@atb/mobile-token';
import {StyleSheet, Theme, useThemeContext} from '@atb/theme';
import {ThemedTokenPhone, ThemedTokenTravelCard} from '@atb/theme/ThemedAssets';
import {useFareContracts} from '@atb/ticketing';
import {dictionary, TravelTokenTexts, useTranslation} from '@atb/translations';
import {animateNextChange} from '@atb/utils/animation';
import React, {useCallback, useEffect, useState} from 'react';
import {ActivityIndicator, View} from 'react-native';
import {ScrollView} from 'react-native-gesture-handler';
import {RadioGroupSection} from '@atb/components/sections';
import {useRemoteConfigContext} from '@atb/RemoteConfigContext';
import {
findReferenceDataById,
isOfFareProductRef,
useFirestoreConfigurationContext,
} from '@atb/configuration';
import {useTimeContext} from '@atb/time';
import {getDeviceNameWithUnitInfo} from './utils';
import {TokenToggleInfo} from '@atb/token-toggle-info';
import {useTokenToggleDetailsQuery} from '@atb/mobile-token/use-token-toggle-details';
Expand All @@ -36,16 +29,11 @@ export const SelectTravelTokenScreenComponent = ({onAfterSave}: Props) => {
const {theme} = useThemeContext();

const {disable_travelcard} = useRemoteConfigContext();
const {fareProductTypeConfigs, preassignedFareProducts} =
useFirestoreConfigurationContext();

const {completeOnboardingSection} = useOnboardingContext();

const {tokens} = useMobileTokenContext();
const toggleMutation = useToggleTokenMutation();
const {data} = useTokenToggleDetailsQuery();

const {serverNow} = useTimeContext();
const inspectableToken = tokens.find((t) => t.isInspectable);

const [selectedType, setSelectedType] = useState<Token['type']>(
Expand All @@ -56,28 +44,6 @@ export const SelectTravelTokenScreenComponent = ({onAfterSave}: Props) => {
inspectableToken,
);

const {fareContracts: availableFareContracts} = useFareContracts(
{availability: 'available'},
serverNow,
);

const availableTravelRights = availableFareContracts.flatMap(
(fc) => fc.travelRights,
);

// Filter for unique travel rights config types
availableTravelRights.map((travelRight) => {
const preassignedFareProduct = findReferenceDataById(
preassignedFareProducts,
isOfFareProductRef(travelRight) ? travelRight.fareProductRef : '',
);

return (
preassignedFareProduct &&
fareProductTypeConfigs.find((c) => c.type === preassignedFareProduct.type)
);
});

useEffect(() => {
// Whenever a user enters this screen, the onboarding is done.
// This useEffect is needed for when onboarding was skipped because of
Expand Down
5 changes: 0 additions & 5 deletions src/stacks-hierarchy/RootStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {Root_LoginPhoneInputScreen} from '@atb/stacks-hierarchy/Root_LoginPhoneI
import {Root_LoginConfirmCodeScreen} from '@atb/stacks-hierarchy/Root_LoginConfirmCodeScreen';
import {Root_LoginRequiredForFareProductScreen} from '@atb/stacks-hierarchy/Root_LoginRequiredForFareProductScreen';
import {Root_ConfirmationScreen} from './Root_ConfirmationScreen';
import {Root_ActiveTokenOnPhoneRequiredForFareProductScreen} from '@atb/stacks-hierarchy/Root_ActiveTokenOnPhoneRequiredForFareProductScreen';
import {
LoadingScreen,
LoadingScreenBoundary,
Expand Down Expand Up @@ -388,10 +387,6 @@ export const RootStack = () => {
name="Root_ConfirmationScreen"
component={Root_ConfirmationScreen}
/>
<Stack.Screen
name="Root_ActiveTokenOnPhoneRequiredForFareProductScreen"
component={Root_ActiveTokenOnPhoneRequiredForFareProductScreen}
/>
<Stack.Screen
name="Root_ScooterHelpScreen"
component={Root_ScooterHelpScreen}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import React, {useEffect, useState} from 'react';
import {ScrollView, View} from 'react-native';
import {ProductSelection} from './components/ProductSelection';
import {PurchaseMessage} from './components/PurchaseMessage.tsx';
import {StartTimeSelection} from './components/StartTimeSelection';
import {Summary} from './components/Summary';
import {TravellerSelection} from './components/TravellerSelection';
Expand Down Expand Up @@ -39,6 +38,7 @@ import {
useSelectableUserProfiles,
} from '@atb/modules/purchase-selection';
import {useProductAlternatives} from '@atb/stacks-hierarchy/Root_PurchaseOverviewScreen/use-product-alternatives';
import {useOtherDeviceIsInspectableWarning} from '@atb/modules/fare-contracts';

type Props = RootStackScreenProps<'Root_PurchaseOverviewScreen'>;

Expand All @@ -58,6 +58,7 @@ export const Root_PurchaseOverviewScreen: React.FC<Props> = ({
const selectableUserProfiles = useSelectableUserProfiles(
selection.preassignedFareProduct,
);
const inspectableTokenWarningText = useOtherDeviceIsInspectableWarning();

const setSelection = (s: PurchaseSelectionType) =>
navigation.setParams({selection: s});
Expand Down Expand Up @@ -275,7 +276,13 @@ export const Root_PurchaseOverviewScreen: React.FC<Props> = ({
/>
) : (
<View style={styles.messages}>
<PurchaseMessage />
{inspectableTokenWarningText && (
<MessageInfoBox
type="warning"
message={inspectableTokenWarningText}
isMarkdown={true}
/>
)}
<GlobalMessage
globalMessageContext={
GlobalMessageContextEnum.appPurchaseOverview
Expand Down

This file was deleted.

7 changes: 0 additions & 7 deletions src/stacks-hierarchy/navigation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ export type Root_LoginRequiredForFareProductScreenParams = {
selection: PurchaseSelectionType;
};

export type Root_ActiveTokenOnPhoneRequiredForFareProductScreenParams = {
nextScreen:
| NextScreenParams<'Root_TabNavigatorStack'>
| NextScreenParams<'Root_PurchaseOverviewScreen'>;
};

type Root_ParkingViolationsPhotoParams = {
selectedViolations: ParkingViolationType[];
};
Expand Down Expand Up @@ -128,7 +122,6 @@ export type RootStackParamList = StackParams<{
Root_LoginConfirmCodeScreen: Root_LoginConfirmCodeScreenParams;
Root_LoginPhoneInputScreen: undefined;
Root_LoginRequiredForFareProductScreen: Root_LoginRequiredForFareProductScreenParams;
Root_ActiveTokenOnPhoneRequiredForFareProductScreen: Root_ActiveTokenOnPhoneRequiredForFareProductScreenParams;
Root_ParkingViolationsSelectScreen: undefined;
Root_ParkingViolationsPhotoScreen: Root_ParkingViolationsPhotoParams;
Root_ParkingViolationsQrScreen: Root_ParkingViolationsQrParams;
Expand Down
13 changes: 0 additions & 13 deletions src/translations/screens/subscreens/TravelToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,19 +259,6 @@ const SelectTravelTokenTexts = {
`We're trying to get your phone ready for ticket usage, but it seems like it's taking some time. Check that your device is connected to the internet, if not we'll try again once the internet connection is restored.`,
`Vi forsøker å klargjere mobilen din til å bruke billettane, men det ser ut til at det tar litt tid. Sjekk om du har tilkopling til internett, og hvis ikkje vil appen prøve på nytt neste gong du får tilkopling.`,
),
notAllowedToUseTravelCardError: {
title: _(
'Kan ikke brukes på t:kort',
'Cannot be used on t:cards',
`Kan ikkje brukast på t:kort`,
),
message: (ticketName: string) =>
_(
`Du har en aktiv ${ticketName}. Det er derfor ikke mulig å bytte til t:kort.`,
`You have an active ${ticketName}. It is therefore not possible to switch to a t:card.`,
`Du har ein aktiv ${ticketName}. Det vil difor ikkje vere mogleg å bytte til t:kort.`,
),
},
unnamedDevice: _('Enhet uten navn', 'Unnamed device', `Eining utan namn`),
},
};
Expand Down

0 comments on commit 92d409e

Please sign in to comment.