Skip to content

Commit

Permalink
Removed AddCurrencies and using SelectCurrency to add currencies for …
Browse files Browse the repository at this point in the history
…conversion
  • Loading branch information
shubhamkmr04 committed Feb 15, 2024
1 parent 94d9b46 commit 7e2e94a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 182 deletions.
4 changes: 0 additions & 4 deletions Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ import Contacts from './views/Settings/Contacts';
import AddContact from './views/Settings/AddContact';
import ContactDetails from './views/ContactDetails';
import CurrencyConverter from './views/Settings/CurrencyConverter';
import AddCurrencies from './views/Settings/AddCurrencies';

// POS
import Order from './views/Order';
Expand Down Expand Up @@ -425,9 +424,6 @@ const AppScenes = {
},
CurrencyConverter: {
screen: CurrencyConverter
},
AddCurrencies: {
screen: AddCurrencies
}
};

Expand Down
156 changes: 0 additions & 156 deletions views/Settings/AddCurrencies.tsx

This file was deleted.

16 changes: 11 additions & 5 deletions views/Settings/CurrencyConverter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ export default class CurrencyConverter extends React.Component<

const AddButton = () => (
<TouchableOpacity
onPress={() => navigation.navigate('AddCurrencies')}
onPress={() =>
navigation.navigate('SelectCurrency', {
currencyConverter: true
})
}
accessibilityLabel={localeString('general.add')}
>
<Add
Expand Down Expand Up @@ -405,10 +409,12 @@ export default class CurrencyConverter extends React.Component<
<Header
leftComponent="Back"
rightComponent={
<Row>
<EditButton />
<AddButton />
</Row>
fiatEnabled && (
<Row>
<EditButton />
<AddButton />
</Row>
)
}
centerComponent={{
text: localeString(
Expand Down
50 changes: 33 additions & 17 deletions views/Settings/SelectCurrency.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export default class SelectCurrency extends React.Component<
this.state;
const { updateSettings, getSettings }: any = SettingsStore;

const currencyConverter = navigation.getParam(
'currencyConverter',
null
);

return (
<Screen>
<View style={{ flex: 1 }}>
Expand Down Expand Up @@ -128,22 +133,32 @@ export default class SelectCurrency extends React.Component<
backgroundColor: 'transparent'
}}
onPress={async () => {
await updateSettings({
fiat: item.value
}).then(() => {
getSettings();
navigation.navigate('Currency', {
refresh: true
if (currencyConverter) {
navigation.navigate(
'CurrencyConverter',
{
selectedCurrency: item.value
}
);
} else {
await updateSettings({
fiat: item.value
}).then(() => {
getSettings();
navigation.navigate('Currency', {
refresh: true
});
});
});
}
}}
>
<ListItem.Content>
<ListItem.Title
style={{
color:
selectedCurrency ===
item.value ||
(!currencyConverter &&
selectedCurrency ===
item.value) ||
(!selectedCurrency &&
item.value === DEFAULT_FIAT)
? themeColor('highlight')
Expand All @@ -156,14 +171,15 @@ export default class SelectCurrency extends React.Component<
</ListItem.Content>
{(selectedCurrency === item.value ||
(!selectedCurrency &&
item.value === DEFAULT_FIAT)) && (
<View style={{ textAlign: 'right' }}>
<Icon
name="check"
color={themeColor('highlight')}
/>
</View>
)}
item.value === DEFAULT_FIAT)) &&
!currencyConverter && (
<View style={{ textAlign: 'right' }}>
<Icon
name="check"
color={themeColor('highlight')}
/>
</View>
)}
</ListItem>
)}
keyExtractor={(item, index) => `${item.host}-${index}`}
Expand Down

0 comments on commit 7e2e94a

Please sign in to comment.