Skip to content

Commit

Permalink
fix(wallet-mobile): crash reporting persistence and catalyst voting
Browse files Browse the repository at this point in the history
  • Loading branch information
banklesss committed Nov 18, 2024
1 parent 9f38d48 commit 3d2c7f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
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 @@ -171,7 +171,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 @@ -183,7 +183,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 @@ -205,9 +205,9 @@ const CrashReportsSwitch = ({crashReportEnabled}: {crashReportEnabled: boolean})
const onToggleCrashReports = () => {
setIsLocalEnabled((prevState) => {
if (prevState) {
enable()
} else {
disable()
} else {
enable()
}

return !prevState
Expand Down
3 changes: 2 additions & 1 deletion apps/wallet-mobile/src/yoroi-wallets/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {Utxos} from '../utils/utils'
const crashReportsStorageKey = 'sendCrashReports'

export const getCrashReportsEnabled = async (storage: AsyncStorageStatic = AsyncStorage) => {
if (isNightly || isDev) return true
const data = await storage.getItem(crashReportsStorageKey)
return parseBoolean(data) ?? false
}
Expand All @@ -44,10 +43,12 @@ const useCrashReportsEnabled = (storage: AsyncStorageStatic = AsyncStorage) => {
suspense: true,
queryKey: [crashReportsStorageKey],
queryFn: () => getCrashReportsEnabled(storage),
enabled: !isNightly && !isDev,
})

if (query.data == null) throw new Error('invalid state')

if (isNightly || isDev) return true
return query.data
}

Expand Down

0 comments on commit 3d2c7f7

Please sign in to comment.