Skip to content

Commit

Permalink
fix(wallet-mobile): crash reporting persistence and catalyst votin
Browse files Browse the repository at this point in the history
  • Loading branch information
banklesss committed Nov 18, 2024
1 parent 6e6c601 commit 2dcec2f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 43 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 @@ -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 @@ -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 @@ -214,7 +214,7 @@ const CrashReportsSwitch = ({crashReportEnabled}: {crashReportEnabled: boolean})
})
}

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 @@ -35,7 +35,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 @@ -45,10 +44,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
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"start": {
"line": 261,
"column": 11,
"index": 9382
"index": 9398
},
"end": {
"line": 264,
"column": 3,
"index": 9492
"index": 9508
}
},
{
Expand All @@ -21,12 +21,12 @@
"start": {
"line": 265,
"column": 21,
"index": 9515
"index": 9531
},
"end": {
"line": 268,
"column": 3,
"index": 9648
"index": 9664
}
},
{
Expand All @@ -36,12 +36,12 @@
"start": {
"line": 269,
"column": 18,
"index": 9668
"index": 9684
},
"end": {
"line": 272,
"column": 3,
"index": 9780
"index": 9796
}
},
{
Expand All @@ -51,12 +51,12 @@
"start": {
"line": 273,
"column": 15,
"index": 9797
"index": 9813
},
"end": {
"line": 276,
"column": 3,
"index": 9903
"index": 9919
}
},
{
Expand All @@ -66,12 +66,12 @@
"start": {
"line": 277,
"column": 22,
"index": 9927
"index": 9943
},
"end": {
"line": 280,
"column": 3,
"index": 10048
"index": 10064
}
},
{
Expand All @@ -81,12 +81,12 @@
"start": {
"line": 281,
"column": 9,
"index": 10059
"index": 10075
},
"end": {
"line": 284,
"column": 3,
"index": 10159
"index": 10175
}
},
{
Expand All @@ -96,12 +96,12 @@
"start": {
"line": 285,
"column": 18,
"index": 10179
"index": 10195
},
"end": {
"line": 288,
"column": 3,
"index": 10306
"index": 10322
}
},
{
Expand All @@ -111,12 +111,12 @@
"start": {
"line": 289,
"column": 13,
"index": 10321
"index": 10337
},
"end": {
"line": 292,
"column": 3,
"index": 10430
"index": 10446
}
},
{
Expand All @@ -126,12 +126,12 @@
"start": {
"line": 293,
"column": 15,
"index": 10447
"index": 10463
},
"end": {
"line": 296,
"column": 3,
"index": 10560
"index": 10576
}
},
{
Expand All @@ -141,12 +141,12 @@
"start": {
"line": 297,
"column": 19,
"index": 10581
"index": 10597
},
"end": {
"line": 300,
"column": 3,
"index": 10742
"index": 10758
}
},
{
Expand All @@ -156,12 +156,12 @@
"start": {
"line": 301,
"column": 20,
"index": 10764
"index": 10780
},
"end": {
"line": 304,
"column": 3,
"index": 10898
"index": 10914
}
},
{
Expand All @@ -171,12 +171,12 @@
"start": {
"line": 305,
"column": 24,
"index": 10924
"index": 10940
},
"end": {
"line": 308,
"column": 3,
"index": 11107
"index": 11123
}
},
{
Expand All @@ -186,12 +186,12 @@
"start": {
"line": 309,
"column": 18,
"index": 11127
"index": 11143
},
"end": {
"line": 312,
"column": 3,
"index": 11258
"index": 11274
}
},
{
Expand All @@ -201,12 +201,12 @@
"start": {
"line": 313,
"column": 22,
"index": 11282
"index": 11298
},
"end": {
"line": 316,
"column": 3,
"index": 11463
"index": 11479
}
},
{
Expand All @@ -216,12 +216,12 @@
"start": {
"line": 317,
"column": 13,
"index": 11478
"index": 11494
},
"end": {
"line": 320,
"column": 3,
"index": 11586
"index": 11602
}
},
{
Expand All @@ -231,12 +231,12 @@
"start": {
"line": 321,
"column": 17,
"index": 11605
"index": 11621
},
"end": {
"line": 324,
"column": 3,
"index": 11722
"index": 11738
}
},
{
Expand All @@ -246,12 +246,12 @@
"start": {
"line": 325,
"column": 17,
"index": 11741
"index": 11757
},
"end": {
"line": 328,
"column": 3,
"index": 11864
"index": 11880
}
},
{
Expand All @@ -261,12 +261,12 @@
"start": {
"line": 329,
"column": 21,
"index": 11887
"index": 11903
},
"end": {
"line": 333,
"column": 3,
"index": 12105
"index": 12121
}
},
{
Expand All @@ -276,12 +276,12 @@
"start": {
"line": 334,
"column": 11,
"index": 12118
"index": 12134
},
"end": {
"line": 337,
"column": 3,
"index": 12222
"index": 12238
}
}
]

0 comments on commit 2dcec2f

Please sign in to comment.