-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #593 from tonkeeper/release/3.4.1
Release 3.4.1
- Loading branch information
Showing
96 changed files
with
1,769 additions
and
1,004 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// list of know for client TLDs for TON DNS | ||
export enum KnownTLDs { | ||
TON = 'ton', | ||
TELEGRAM = 't.me', | ||
} | ||
|
||
export class DNS { | ||
// get known TLD from domain. Uses for TLD-specific features like Telegram buttons in UI | ||
static getTLD(domain: string) { | ||
if (!DNS.isValid(domain)) { | ||
return null; | ||
} | ||
|
||
if (domain.endsWith(KnownTLDs.TON)) { | ||
return KnownTLDs.TON; | ||
} | ||
|
||
if (domain.endsWith(KnownTLDs.TELEGRAM)) { | ||
return KnownTLDs.TELEGRAM; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
static isValid(domain?: string) { | ||
if (!domain) { | ||
return false; | ||
} | ||
return domain.includes('.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
packages/mobile/src/core/AddressUpdateInfo/AddressUpdateInfo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
import { copyText } from '$hooks/useCopyText'; | ||
import { Spacer } from '$uikit'; | ||
import { Address } from '@tonkeeper/core'; | ||
import { t } from '@tonkeeper/shared/i18n'; | ||
import { tk } from '@tonkeeper/shared/tonkeeper'; | ||
import { Pressable, Screen, Steezy, Text, View } from '@tonkeeper/uikit'; | ||
import { DarkTheme } from '@tonkeeper/uikit/src/styles/themes/dark'; | ||
import React, { FC } from 'react'; | ||
import { Platform } from 'react-native'; | ||
import { SafeAreaView } from 'react-native-safe-area-context'; | ||
|
||
const fontFamily = Platform.select({ | ||
ios: 'SFMono-Medium', | ||
android: 'RobotoMono-Medium', | ||
}); | ||
|
||
const splitAddress = (address: string) => { | ||
return { | ||
start: address.substring(0, 2), | ||
middle: address.substring(2, address.length - 4), | ||
end: address.substring(address.length - 4, address.length), | ||
}; | ||
}; | ||
|
||
export const AddressUpdateInfo: FC = () => { | ||
const oldAddress = Address.parse(tk.wallet.address.ton.raw).toFriendly({ | ||
bounceable: true, | ||
}); | ||
const newAddress = Address.parse(tk.wallet.address.ton.raw).toFriendly({ | ||
bounceable: false, | ||
}); | ||
const oldStyle = splitAddress(oldAddress); | ||
const newStyle = splitAddress(newAddress); | ||
|
||
return ( | ||
<Screen> | ||
<Screen.Header title={t('address_update.title')} /> | ||
<Screen.ScrollView> | ||
<View style={styles.content}> | ||
<Text type="body2" color="textSecondary"> | ||
{t('address_update.post_top')} | ||
</Text> | ||
<Spacer y={16} /> | ||
<View style={styles.labelContainer}> | ||
<Text type="label1">{t('address_update.your_wallet')}</Text> | ||
</View> | ||
<Pressable | ||
underlayColor={DarkTheme.backgroundContentTint} | ||
backgroundColor={DarkTheme.fieldBackground} | ||
style={styles.addressContainer} | ||
onPress={() => copyText(oldAddress)} | ||
> | ||
<Text type="body3" color="textSecondary"> | ||
{t('address_update.old_style')} | ||
</Text> | ||
<Text numberOfLines={1} ellipsizeMode="middle" style={{ fontFamily }}> | ||
<Text color="textAccent" style={{ fontFamily }}> | ||
{oldStyle.start} | ||
</Text> | ||
{oldStyle.middle} | ||
<Text color="textAccent" style={{ fontFamily }}> | ||
{oldStyle.end} | ||
</Text> | ||
</Text> | ||
</Pressable> | ||
<Spacer y={16} /> | ||
<Pressable | ||
underlayColor={DarkTheme.backgroundContentTint} | ||
backgroundColor={DarkTheme.fieldBackground} | ||
style={styles.addressContainer} | ||
onPress={() => copyText(newAddress)} | ||
> | ||
<Text type="body3" color="textSecondary"> | ||
{t('address_update.new_style')} | ||
</Text> | ||
<Text numberOfLines={1} ellipsizeMode="middle" style={{ fontFamily }}> | ||
<Text color="textAccent" style={{ fontFamily }}> | ||
{newStyle.start} | ||
</Text> | ||
{newStyle.middle} | ||
<Text color="textAccent" style={{ fontFamily }}> | ||
{newStyle.end} | ||
</Text> | ||
</Text> | ||
</Pressable> | ||
<Spacer y={16} /> | ||
<View style={styles.labelContainer}> | ||
<Text type="label1">{t('address_update.why_change')}</Text> | ||
</View> | ||
<Text type="body2" color="textSecondary"> | ||
{t('address_update.post_rest')} | ||
</Text> | ||
<View style={styles.option}> | ||
<View style={styles.optionNum}> | ||
<Text type="body2" color="textSecondary"> | ||
{'1. '} | ||
</Text> | ||
</View> | ||
<Text type="body2" color="textSecondary"> | ||
{t('address_update.first_option')} | ||
</Text> | ||
</View> | ||
<View style={styles.option}> | ||
<View style={styles.optionNum}> | ||
<Text type="body2" color="textSecondary"> | ||
{'2. '} | ||
</Text> | ||
</View> | ||
<Text type="body2" color="textSecondary"> | ||
{t('address_update.second_option')} | ||
</Text> | ||
</View> | ||
<Text type="body2" color="textSecondary"> | ||
{t('address_update.post_dates')} | ||
</Text> | ||
</View> | ||
<SafeAreaView edges={['bottom']} /> | ||
</Screen.ScrollView> | ||
</Screen> | ||
); | ||
}; | ||
|
||
const styles = Steezy.create(({ colors, corners }) => ({ | ||
container: { | ||
flex: 1, | ||
}, | ||
content: { | ||
paddingTop: 12, | ||
paddingBottom: 16, | ||
paddingHorizontal: 16, | ||
}, | ||
labelContainer: { | ||
paddingVertical: 12, | ||
}, | ||
option: { | ||
paddingLeft: 22, | ||
position: 'relative', | ||
}, | ||
optionNum: { | ||
position: 'absolute', | ||
top: 0, | ||
left: 5, | ||
}, | ||
addressContainer: { | ||
paddingHorizontal: 16, | ||
paddingVertical: 12, | ||
backgroundColor: colors.fieldBackground, | ||
borderRadius: corners.medium, | ||
}, | ||
})); |
Oops, something went wrong.