Skip to content

Commit

Permalink
Merge branch 'develop' into feat/remote-notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljscript authored Dec 16, 2024
2 parents 76f66df + 01e4a1c commit 2a4be64
Show file tree
Hide file tree
Showing 24 changed files with 274 additions and 229 deletions.
2 changes: 1 addition & 1 deletion apps/wallet-mobile/.tool-versions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nodejs 18.19.1
rust 1.69.0
java adoptopenjdk-17.0.10+7
ruby 3.2.2
ruby 3.1.2
python 3.11.3
4 changes: 2 additions & 2 deletions apps/wallet-mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ android {
applicationId "com.emurgo"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionName "5.0.1"
versionCode 732
versionName "5.0.2"
versionCode 738
testBuildType System.getProperty('testBuildType', 'debug')
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
Expand Down
4 changes: 2 additions & 2 deletions apps/wallet-mobile/ios/nightly.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.0.1</string>
<string>5.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>619</string>
<string>625</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
8 changes: 4 additions & 4 deletions apps/wallet-mobile/ios/yoroi.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@
CODE_SIGN_ENTITLEMENTS = yoroi/yoroi.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 619;
CURRENT_PROJECT_VERSION = 625;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = F8NVT2G2L4;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -905,7 +905,7 @@
CODE_SIGN_ENTITLEMENTS = yoroi/yoroi.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 619;
CURRENT_PROJECT_VERSION = 625;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = F8NVT2G2L4;
ENVFILE = "$(PODS_ROOT)/../../.env.production";
Expand Down Expand Up @@ -1101,7 +1101,7 @@
CODE_SIGN_ENTITLEMENTS = nightly.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 619;
CURRENT_PROJECT_VERSION = 625;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = F8NVT2G2L4;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -1146,7 +1146,7 @@
CODE_SIGN_ENTITLEMENTS = nightly.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 619;
CURRENT_PROJECT_VERSION = 625;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = F8NVT2G2L4;
ENVFILE = "$(PODS_ROOT)/../../.env.nightly";
Expand Down
4 changes: 2 additions & 2 deletions apps/wallet-mobile/ios/yoroi/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>5.0.1</string>
<string>5.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -34,7 +34,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>619</string>
<string>625</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationCategoryType</key>
Expand Down
4 changes: 2 additions & 2 deletions apps/wallet-mobile/ios/yoroiTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>5.0.1</string>
<string>5.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>619</string>
<string>625</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions apps/wallet-mobile/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yoroi/wallet-mobile",
"version": "5.0.1",
"version": "5.0.2",
"private": true,
"scripts": {
"android-bundle": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res",
Expand Down Expand Up @@ -101,7 +101,7 @@
"@emurgo/csl-mobile-bridge": "^7.1.0",
"@emurgo/msl-mobile-bridge": "^1.0.4",
"@emurgo/react-native-hid": "5.15.8",
"@emurgo/yoroi-lib": "2.2.1",
"@emurgo/yoroi-lib": "2.2.2",
"@formatjs/intl-datetimeformat": "^6.7.0",
"@formatjs/intl-getcanonicallocales": "^2.1.0",
"@formatjs/intl-locale": "^3.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ export const ClipboardProvider = ({children}: Props) => {
const [copied, setCopied] = React.useState<CopiedState | null>(null)
const {height, width} = useWindowDimensions()
const copy: ClipboardContext['copy'] = ({text, feedback = 'Copied', event}) => {
const baseLocationX = (event?.nativeEvent.pageX ?? width * 0.5) - feedback.length * 4
const maxX = width - 20 - feedback.length * 8
const minX = 20 + feedback.length * 8
const locationX = Math.min(Math.max(baseLocationX, minX), maxX)

Clipboard.setString(text)
setCopied({
feedback,
locationY: event ? event.nativeEvent.pageY - 50 : height * 0.85,
locationX: (event?.nativeEvent.pageX ?? width * 0.5) - feedback.length * 4,
locationX,
})
setTimeout(() => setCopied(null), FEEDBACK_TIMEOUT)
}
Expand Down
30 changes: 16 additions & 14 deletions apps/wallet-mobile/src/components/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useTheme} from '@yoroi/theme'
import React from 'react'
import {StyleProp, ViewStyle} from 'react-native'
import {StyleProp, View, ViewStyle} from 'react-native'

import {Icon} from '../components/Icon'
import {Button, ButtonType} from './Button/Button'
Expand All @@ -15,22 +15,24 @@ type CopyButtonProps = {
message?: string
}

export const CopyButton = ({title, value, onCopy, message}: CopyButtonProps) => {
export const CopyButton = ({title, value, onCopy, message, style}: CopyButtonProps) => {
const {isCopying, copy} = useCopy()
const {atoms} = useTheme()

return (
<Button
type={ButtonType.SecondaryText}
fontOverride={atoms.body_1_lg_regular}
style={{...atoms.p_0, ...atoms.justify_between}}
title={title}
icon={isCopying ? Icon.CopySuccess : Icon.Copy}
rightIcon
onPress={(event) => {
copy({text: value, feedback: message, event})
onCopy?.()
}}
/>
<View style={style}>
<Button
type={ButtonType.SecondaryText}
fontOverride={atoms.body_1_lg_regular}
style={{...atoms.p_0, ...atoms.justify_between, flexGrow: 0}}
title={title}
icon={isCopying ? Icon.CopySuccess : Icon.Copy}
rightIcon
onPress={(event) => {
copy({text: value, feedback: message, event})
onCopy?.()
}}
/>
</View>
)
}
42 changes: 31 additions & 11 deletions apps/wallet-mobile/src/features/Discover/common/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,47 @@ async function formatLedgerWithdrawals(
): Promise<Array<Withdrawal>> {
const result: Array<Withdrawal> = []

const withdrawalKeys = await withdrawals.keys()
for (let i = 0; i < (await withdrawalKeys.len()); i++) {
const rewardAddress = await withdrawalKeys.get(i)
const keys = await withdrawals.keys()
const keysLength = await keys.len()
for (let i = 0; i < keysLength; i++) {
const rewardAddress = await keys.get(i)
const withdrawalAmount = await withdrawals.get(rewardAddress)
if (withdrawalAmount == null) {
throw new Error(`formatLedgerWithdrawals should never happen`)
}

const rewardAddressPayload = Buffer.from(await rewardAddress.toAddress().then((a) => a.toBytes())).toString('hex')
const rewardAddressPayload = await (await rewardAddress.toAddress()).toHex()
const addressing = addressingMap(rewardAddressPayload)
if (addressing == null) {
throw new Error(`formatLedgerWithdrawals Ledger can only withdraw from own address ${rewardAddressPayload}`)
let stakeCredential: null | Withdrawal['stakeCredential'] = null
if (addressing != null) {
stakeCredential = {
type: CredentialParamsType.KEY_PATH,
keyPath: addressing.path,
}
} else {
const cred = await rewardAddress.paymentCred()
const maybeKeyHash = await cred.toKeyhash()
const maybeScriptHash = await cred.toScripthash()
if (maybeKeyHash) {
stakeCredential = {
type: CredentialParamsType.KEY_HASH,
keyHashHex: await maybeKeyHash.toHex(),
}
} else if (maybeScriptHash) {
stakeCredential = {
type: CredentialParamsType.SCRIPT_HASH,
scriptHashHex: await maybeScriptHash.toHex(),
}
}
}
if (stakeCredential === null) {
throw new Error('Failed to resolve credential type for reward address: ' + rewardAddressPayload)
}
result.push({
amount: await withdrawalAmount.toStr(),
stakeCredential: {
type: CredentialParamsType.KEY_PATH,
keyPath: addressing.path,
},
stakeCredential,
})
}

return result
}
async function formatLedgerCertificates(
Expand Down
4 changes: 2 additions & 2 deletions apps/wallet-mobile/src/features/Menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const KnowledgeBase = Item
const Catalyst = ({label, left, onPress}: {label: string; left: React.ReactElement; onPress: () => void}) => {
const strings = useStrings()
const {wallet} = useSelectedWallet()
const {canVote, sufficientFunds} = useCanVote(wallet)
const {sufficientFunds} = useCanVote(wallet)
const {openModal} = useModal()
const screenHeight = useWindowDimensions().height
const modalHeight = Math.min(screenHeight * 0.8, 256)
Expand All @@ -200,7 +200,7 @@ const Catalyst = ({label, left, onPress}: {label: string; left: React.ReactEleme
openModal(strings.attention, <InsufficientFundsModal />, modalHeight)
}
}
return <Item label={label} onPress={handlePress} left={left} disabled={!canVote} />
return <Item label={label} onPress={handlePress} left={left} />
}

const SUPPORT_TICKET_LINK = 'https://emurgohelpdesk.zendesk.com/hc/en-us/requests/new?ticket_form_id=360013330335'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const TokenChartComponent = ({dataSources = [], onValueSelected}: Props) => {

const screenWidth = Dimensions.get('window').width
const x0 = 0 // x0 position
const chartWidth = screenWidth - x0
const chartWidth = screenWidth - x0 - 16 // 16 = padding
const xN = x0 + chartWidth // xN position
const xDistance = chartWidth / dataSize // The width of each coordinate point

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const useStrings = () => {
iUnderstandButton: intl.formatMessage(confirmationMessages.commonButtons.iUnderstandButton),
attention: intl.formatMessage(globalMessages.attention),
registrationStart: intl.formatMessage(messages.registrationStart),
snapshotStart: intl.formatMessage(messages.snapshotStart),
votingStart: intl.formatMessage(messages.votingStart),
votingEnd: intl.formatMessage(messages.votingEnd),
votingResults: intl.formatMessage(messages.votingResults),
Expand Down Expand Up @@ -71,6 +72,10 @@ const messages = defineMessages({
id: 'catalyst.registration.start',
defaultMessage: '!!!Registration start',
},
snapshotStart: {
id: 'catalyst.snapshot.start',
defaultMessage: '!!!Snapshot start',
},
votingStart: {
id: 'catalyst.voting.start',
defaultMessage: '!!!Voting start',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ export const DownloadCatalystAppScreen = () => {
}, [openModal, stakingInfo?.status, strings.attention])

const fundName = fund.info.fundName
const registrationStart = `${formatDate(fund.info.snapshotStart)}: ${strings.registrationStart}`
const registrationStart = `${formatDate(fund.info.snapshotStart)}: ${strings.snapshotStart}`
const votingStart = `${formatDate(fund.info.votingStart)}: ${strings.votingStart}`
const votingEnd = `${formatDate(fund.info.votingEnd)}: ${strings.votingEnd}`
const votingResults = `${formatDate(fund.info.tallyingEnd)}: ${strings.votingResults}`

const disabled = wallet.isMainnet && fund.status.registration !== 'running'

return (
<SafeAreaView edges={['left', 'right', 'bottom']} style={styles.safeAreaView}>
<Stepper title={strings.title} currentStep={1} totalSteps={3} />
Expand Down Expand Up @@ -98,7 +96,7 @@ export const DownloadCatalystAppScreen = () => {
</ScrollView>

<Actions>
<Button onPress={onNext} title={strings.continueButton} disabled={disabled} />
<Button onPress={onNext} title={strings.continueButton} />
</Actions>
</SafeAreaView>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const MetadataTab = ({metadata, hash}: FormattedMetadata) => {

<Space height="lg" />

<Text>{metadataFormatted}</Text>
<Text style={styles.metadataText}>{metadataFormatted}</Text>
</View>
</View>
)
Expand Down Expand Up @@ -80,6 +80,10 @@ const useStyles = () => {
...atoms.body_1_lg_medium,
color: color.text_gray_medium,
},
metadataText: {
color: color.text_gray_medium,
...atoms.body_2_md_regular,
},
})

return {styles} as const
Expand Down
Loading

0 comments on commit 2a4be64

Please sign in to comment.