Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wallet-mobile): crash reporting persistence and catalyst voting #3741

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -7,7 +7,7 @@ import {SafeAreaView} from 'react-native-safe-area-context'

import {Icon} from '../../../components/Icon'
import {Spacer} from '../../../components/Spacer/Spacer'
import {isNightly, isProduction} from '../../../kernel/env'
import {isDev, isNightly, isProduction} from '../../../kernel/env'
import {useLanguage} from '../../../kernel/i18n'
import {themeNames} from '../../../kernel/i18n/global-messages'
import {defaultLanguage} from '../../../kernel/i18n/languages'
Expand Down Expand Up @@ -205,16 +205,16 @@ const CrashReportsSwitch = ({crashReportEnabled}: {crashReportEnabled: boolean})
const onToggleCrashReports = () => {
setIsLocalEnabled((prevState) => {
if (prevState) {
enable()
} else {
disable()
} else {
enable()
}

return !prevState
})
}

return <SettingsSwitch value={isLocalEnabled} onValueChange={onToggleCrashReports} disabled={isNightly} />
return <SettingsSwitch value={isLocalEnabled} onValueChange={onToggleCrashReports} disabled={isNightly || isDev} />
}

// to avoid switch jumps
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
Loading