Skip to content

Commit 736c0ec

Browse files
chore: remove i18n and sentry remote config (#6478)
### Description This PR removes remote config for: - allowOtaTranslations - this should be configured via the app config, it seems unnecessary to remotely configure it given that it is a mature feature now and unlikely needs to be switched off dynamically (an equivalent action is to simply stop pushing OTA translations) - sentryTracesSampleRate - we've never needed to change this value - sentryNetworkErrors - we've never needed to change this value Removing dynamic config for these allows us to simplify the interdependencies of core dependencies, and the app init saga can work more reliably. ### Test plan n/a ### Related issues - Related to RET-1272 ### Backwards compatibility Y ### Network scalability If a new NetworkId and/or Network are added in the future, the changes in this PR will: - [ ] Continue to work without code changes, OR trigger a compilation error (guaranteeing we find it when a new network is added)
1 parent 64931f5 commit 736c0ec

19 files changed

+55
-113
lines changed

src/app/reducers.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ interface State {
2525
// for the migration code. We can remove all the code associated with this after some time has passed.
2626
googleMobileServicesAvailable?: boolean
2727
huaweiMobileServicesAvailable?: boolean
28-
sentryTracesSampleRate: number
29-
sentryNetworkErrors: string[]
3028
supportedBiometryType: BIOMETRY_TYPE | null
3129
fiatConnectCashInEnabled: boolean
3230
fiatConnectCashOutEnabled: boolean
@@ -57,8 +55,6 @@ const initialState = {
5755
activeScreen: Screens.Main,
5856
googleMobileServicesAvailable: undefined,
5957
huaweiMobileServicesAvailable: undefined,
60-
sentryTracesSampleRate: REMOTE_CONFIG_VALUES_DEFAULTS.sentryTracesSampleRate,
61-
sentryNetworkErrors: REMOTE_CONFIG_VALUES_DEFAULTS.sentryNetworkErrors.split(','),
6258
supportedBiometryType: null,
6359
fiatConnectCashInEnabled: REMOTE_CONFIG_VALUES_DEFAULTS.fiatConnectCashInEnabled,
6460
fiatConnectCashOutEnabled: REMOTE_CONFIG_VALUES_DEFAULTS.fiatConnectCashOutEnabled,
@@ -150,8 +146,6 @@ export const appReducer = (
150146
case Actions.UPDATE_REMOTE_CONFIG_VALUES:
151147
return {
152148
...state,
153-
sentryTracesSampleRate: action.configValues.sentryTracesSampleRate,
154-
sentryNetworkErrors: action.configValues.sentryNetworkErrors,
155149
fiatConnectCashInEnabled: action.configValues.fiatConnectCashInEnabled,
156150
fiatConnectCashOutEnabled: action.configValues.fiatConnectCashOutEnabled,
157151
}

src/app/saga.test.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,12 @@ import {
2727
getLastTimeBackgrounded,
2828
getRequirePinOnAppOpen,
2929
inAppReviewLastInteractionTimestampSelector,
30-
sentryNetworkErrorsSelector,
3130
} from 'src/app/selectors'
3231
import { DEEP_LINK_URL_SCHEME } from 'src/config'
3332
import { activeDappSelector } from 'src/dapps/selectors'
3433
import { FiatExchangeFlow } from 'src/fiatExchanges/types'
3534
import { initI18n } from 'src/i18n'
36-
import {
37-
allowOtaTranslationsSelector,
38-
currentLanguageSelector,
39-
otaTranslationsAppVersionSelector,
40-
} from 'src/i18n/selectors'
35+
import { currentLanguageSelector, otaTranslationsAppVersionSelector } from 'src/i18n/selectors'
4136
import { jumpstartLinkHandler } from 'src/jumpstart/jumpstartLinkHandler'
4237
import { navigate } from 'src/navigator/NavigationService'
4338
import { Screens } from 'src/navigator/Screens'
@@ -548,10 +543,8 @@ describe('appInit', () => {
548543
})
549544

550545
const defaultProviders: (EffectProviders | StaticProvider)[] = [
551-
[select(allowOtaTranslationsSelector), true],
552546
[select(otaTranslationsAppVersionSelector), '1'],
553547
[select(currentLanguageSelector), 'nl-NL'],
554-
[select(sentryNetworkErrorsSelector), ['network error']],
555548
]
556549

557550
it('should initialise the correct components, with the stored language', async () => {

src/app/saga.ts

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import { AppEvents, InviteEvents } from 'src/analytics/Events'
1010
import { HooksEnablePreviewOrigin } from 'src/analytics/types'
1111
import {
1212
Actions,
13-
OpenDeepLink,
14-
OpenUrlAction,
15-
SetAppState,
1613
androidMobileServicesAvailabilityChecked,
1714
appLock,
1815
inAppReviewRequested,
1916
inviteLinkConsumed,
17+
OpenDeepLink,
2018
openDeepLink,
19+
OpenUrlAction,
20+
SetAppState,
2121
setAppState,
2222
setSupportedBiometryType,
2323
updateRemoteConfigValues,
@@ -28,18 +28,19 @@ import {
2828
googleMobileServicesAvailableSelector,
2929
huaweiMobileServicesAvailableSelector,
3030
inAppReviewLastInteractionTimestampSelector,
31-
sentryNetworkErrorsSelector,
3231
} from 'src/app/selectors'
33-
import { DEFAULT_APP_LANGUAGE, FETCH_TIMEOUT_DURATION, isE2EEnv } from 'src/config'
32+
import {
33+
DEFAULT_APP_LANGUAGE,
34+
DEFAULT_SENTRY_NETWORK_ERRORS,
35+
ENABLE_OTA_TRANSLATIONS,
36+
FETCH_TIMEOUT_DURATION,
37+
isE2EEnv,
38+
} from 'src/config'
3439
import { FiatExchangeFlow } from 'src/fiatExchanges/types'
3540
import { FiatAccountSchemaCountryOverrides } from 'src/fiatconnect/types'
3641
import { fetchRemoteConfigValues } from 'src/firebase/firebase'
3742
import { initI18n } from 'src/i18n'
38-
import {
39-
allowOtaTranslationsSelector,
40-
currentLanguageSelector,
41-
otaTranslationsAppVersionSelector,
42-
} from 'src/i18n/selectors'
43+
import { currentLanguageSelector, otaTranslationsAppVersionSelector } from 'src/i18n/selectors'
4344
import { jumpstartClaim } from 'src/jumpstart/saga'
4445
import { navigate, navigateHome } from 'src/navigator/NavigationService'
4546
import { Screens } from 'src/navigator/Screens'
@@ -97,15 +98,16 @@ const REVIEW_INTERVAL = ONE_DAY_IN_MILLIS * 120 // 120 days
9798
// Work that's done before other sagas are initalized
9899
// Be mindful to not put long blocking tasks here
99100
export function* appInit() {
101+
yield* call(initializeSentry)
102+
100103
SentryTransactionHub.startTransaction(SentryTransaction.app_init_saga)
101104

102-
const allowOtaTranslations = yield* select(allowOtaTranslationsSelector)
103105
const otaTranslationsAppVersion = yield* select(otaTranslationsAppVersionSelector)
104106
const language = yield* select(currentLanguageSelector)
105107
const bestLanguage = findBestLanguageTag(Object.keys(locales))?.languageTag
108+
const allowOtaTranslations = ENABLE_OTA_TRANSLATIONS
106109

107110
yield* all([
108-
call(initializeSentry),
109111
call([AppAnalytics, 'init']),
110112
call(
111113
initI18n,
@@ -115,10 +117,7 @@ export function* appInit() {
115117
),
116118
])
117119

118-
// This step is important if the user is offline and unable to fetch remote
119-
// config values, we can use the persisted value instead of an empty one
120-
const sentryNetworkErrors = yield* select(sentryNetworkErrorsSelector)
121-
Logger.setNetworkErrors(sentryNetworkErrors)
120+
Logger.setNetworkErrors(DEFAULT_SENTRY_NETWORK_ERRORS)
122121

123122
const supportedBiometryType = yield* call(Keychain.getSupportedBiometryType)
124123
yield* put(setSupportedBiometryType(supportedBiometryType))
@@ -176,9 +175,6 @@ export function* checkAndroidMobileServicesSaga() {
176175

177176
export interface RemoteConfigValues {
178177
inviteRewardsVersion: string
179-
allowOtaTranslations: boolean
180-
sentryTracesSampleRate: number
181-
sentryNetworkErrors: string[]
182178
fiatConnectCashInEnabled: boolean
183179
fiatConnectCashOutEnabled: boolean
184180
fiatAccountSchemaCountryOverrides: FiatAccountSchemaCountryOverrides
@@ -202,7 +198,6 @@ export function* appRemoteFeatureFlagSaga() {
202198
timeout: delay(FETCH_TIMEOUT_DURATION),
203199
})
204200
if (configValues) {
205-
Logger.setNetworkErrors(configValues.sentryNetworkErrors)
206201
yield* put(updateRemoteConfigValues(configValues))
207202
lastLoadTime = Date.now()
208203
}

src/app/selectors.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ export const googleMobileServicesAvailableSelector = (state: RootState) =>
3030
export const huaweiMobileServicesAvailableSelector = (state: RootState) =>
3131
state.app.huaweiMobileServicesAvailable
3232

33-
export const sentryTracesSampleRateSelector = (state: RootState) => state.app.sentryTracesSampleRate
34-
35-
export const sentryNetworkErrorsSelector = (state: RootState) => state.app.sentryNetworkErrors
36-
3733
export const supportedBiometryTypeSelector = (state: RootState) => state.app.supportedBiometryType
3834

3935
export const fiatConnectCashInEnabledSelector = (state: RootState) =>

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export const SIMPLEX_FEES_URL =
161161

162162
export const APP_STORE_ID = Config.APP_STORE_ID
163163
export const DYNAMIC_LINK_DOMAIN_URI_PREFIX = 'https://vlra.app'
164+
export const ENABLE_OTA_TRANSLATIONS = true
164165
export const CROWDIN_DISTRIBUTION_HASH = 'e-f9f6869461793b9d1a353b2v7c'
165166
export const OTA_TRANSLATIONS_FILEPATH = `file://${CachesDirectoryPath}/translations`
166167

src/firebase/firebase.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ export async function fetchRemoteConfigValues(): Promise<RemoteConfigValues | nu
274274

275275
return {
276276
inviteRewardsVersion: flags.inviteRewardsVersion.asString(),
277-
allowOtaTranslations: flags.allowOtaTranslations.asBoolean(),
278-
sentryTracesSampleRate: flags.sentryTracesSampleRate.asNumber(),
279-
sentryNetworkErrors: flags.sentryNetworkErrors.asString().split(','),
280277
fiatConnectCashInEnabled: flags.fiatConnectCashInEnabled.asBoolean(),
281278
fiatConnectCashOutEnabled: flags.fiatConnectCashOutEnabled.asBoolean(),
282279
fiatAccountSchemaCountryOverrides: fiatAccountSchemaCountryOverrides

src/firebase/remoteConfigValuesDefaults.e2e.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@ import { RemoteConfigValues } from 'src/app/saga'
22

33
export const REMOTE_CONFIG_VALUES_DEFAULTS: Omit<
44
RemoteConfigValues,
5-
'sentryNetworkErrors' | 'fiatAccountSchemaCountryOverrides'
6-
> & {
7-
sentryNetworkErrors: string
8-
} = {
5+
'fiatAccountSchemaCountryOverrides'
6+
> = {
97
inviteRewardsVersion: 'none',
10-
allowOtaTranslations: false,
11-
sentryTracesSampleRate: 0.2,
12-
sentryNetworkErrors: '',
138
fiatConnectCashInEnabled: false,
149
fiatConnectCashOutEnabled: true,
1510
}
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
import { RemoteConfigValues } from 'src/app/saga'
2-
import { DEFAULT_SENTRY_NETWORK_ERRORS, DEFAULT_SENTRY_TRACES_SAMPLE_RATE } from 'src/config'
32

43
export const REMOTE_CONFIG_VALUES_DEFAULTS: Omit<
54
RemoteConfigValues,
6-
'sentryNetworkErrors' | 'fiatAccountSchemaCountryOverrides'
7-
> & {
8-
sentryNetworkErrors: string
9-
} = {
5+
'fiatAccountSchemaCountryOverrides'
6+
> = {
107
inviteRewardsVersion: 'none',
11-
allowOtaTranslations: false,
12-
sentryTracesSampleRate: DEFAULT_SENTRY_TRACES_SAMPLE_RATE,
13-
sentryNetworkErrors: DEFAULT_SENTRY_NETWORK_ERRORS.join(','),
148
fiatConnectCashInEnabled: false,
159
fiatConnectCashOutEnabled: false,
1610
}

src/i18n/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import hoistStatics from 'hoist-non-react-statics'
22
import i18n, { Resource, ResourceLanguage } from 'i18next'
33
import _ from 'lodash'
44
import {
5-
WithTranslation,
65
initReactI18next,
6+
WithTranslation,
77
withTranslation as withTranslationI18Next,
88
} from 'react-i18next'
99
import DeviceInfo from 'react-native-device-info'

src/i18n/saga.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { call, select } from 'redux-saga/effects'
66
import { saveOtaTranslations } from 'src/i18n/otaTranslations'
77
import { handleFetchOtaTranslations } from 'src/i18n/saga'
88
import {
9-
allowOtaTranslationsSelector,
109
currentLanguageSelector,
1110
otaTranslationsAppVersionSelector,
1211
otaTranslationsLanguageSelector,
@@ -44,7 +43,6 @@ describe('i18n sagas', () => {
4443
const mockedVersion = DeviceInfo.getVersion as jest.MockedFunction<typeof DeviceInfo.getVersion>
4544
mockedVersion.mockImplementation(() => appVersion)
4645
const defaultProviders: (EffectProviders | StaticProvider)[] = [
47-
[select(allowOtaTranslationsSelector), true],
4846
[select(otaTranslationsAppVersionSelector), appVersion],
4947
[select(otaTranslationsLanguageSelector), 'en-US'],
5048
[select(currentLanguageSelector), 'en-US'],

0 commit comments

Comments
 (0)