Skip to content

Commit 4bfa002

Browse files
committed
rename to AppConfigEntry
1 parent d51d207 commit 4bfa002

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

modules/app-config/__tests__/useCourseSearchRecentsScreen.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {renderHook, waitFor} from '@testing-library/react-native'
44
import {QueryClient, QueryClientProvider} from '@tanstack/react-query'
55

66
import {useFeature} from '../index'
7-
import {AppConfigType} from '../types'
7+
import {AppConfigEntry} from '../types'
88

99
jest.mock('../../../modules/constants', () => ({
1010
isDevMode: jest.fn(),
@@ -41,7 +41,7 @@ describe('useCourseSearchRecentsScreen', () => {
4141
getFeatureFlagMock.mockReturnValue(true)
4242

4343
const {result} = renderHook(
44-
() => useFeature(AppConfigType.Courses_ShowRecentSearchScreen),
44+
() => useFeature(AppConfigEntry.Courses_ShowRecentSearchScreen),
4545
{
4646
wrapper: queryWrapper,
4747
},
@@ -57,7 +57,7 @@ describe('useCourseSearchRecentsScreen', () => {
5757
getFeatureFlagMock.mockReturnValue(false)
5858

5959
const {result} = renderHook(
60-
() => useFeature(AppConfigType.Courses_ShowRecentSearchScreen),
60+
() => useFeature(AppConfigEntry.Courses_ShowRecentSearchScreen),
6161
{
6262
wrapper: queryWrapper,
6363
},

modules/app-config/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {getFeatureFlag} from '../../source/lib/storage'
2-
import {AppConfigType, FeatureFlagType} from './types'
2+
import {AppConfigEntry, FeatureFlagType} from './types'
33
import {useQuery} from '@tanstack/react-query'
44
import {isDevMode} from '@frogpond/constants'
55

6-
export type {AppConfigType, FeatureFlagType} from './types'
6+
export type {AppConfigEntry, FeatureFlagType} from './types'
77

88
// helper method to query exported __DEV__ feature flags
9-
export const useFeature = (featureKey: AppConfigType): boolean => {
9+
export const useFeature = (featureKey: AppConfigEntry): boolean => {
1010
let {data: featureValue = false} = useQuery({
1111
queryKey: ['app', 'app:feature-flag', featureKey],
1212
queryFn: () => getFeatureFlag(featureKey),
@@ -23,14 +23,14 @@ export const AppConfig = async (): Promise<FeatureFlagType[]> => {
2323
return [
2424
{
2525
title: 'Show the course search recents screen',
26-
configKey: AppConfigType.Courses_ShowRecentSearchScreen,
26+
configKey: AppConfigEntry.Courses_ShowRecentSearchScreen,
2727
active: await getFeatureFlag(
28-
AppConfigType.Courses_ShowRecentSearchScreen,
28+
AppConfigEntry.Courses_ShowRecentSearchScreen,
2929
),
3030
},
3131
]
3232
}
3333

3434
// exported feature flags
3535
export const useCourseSearchRecentsScreen = (): boolean =>
36-
useFeature(AppConfigType.Courses_ShowRecentSearchScreen)
36+
useFeature(AppConfigEntry.Courses_ShowRecentSearchScreen)

modules/app-config/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export interface FeatureFlagType {
2-
configKey: AppConfigType
2+
configKey: AppConfigEntry
33
title: string
44
active: boolean
55
}
@@ -14,6 +14,6 @@ export interface FeatureFlagType {
1414
* split at render time for our view to group by, but the entirety
1515
* of the value (section + key) will be stored.
1616
*/
17-
export enum AppConfigType {
17+
export enum AppConfigEntry {
1818
Courses_ShowRecentSearchScreen = 'Courses_ShowRecentSearchScreen',
1919
}

source/lib/storage.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
setItem,
77
setStoragePrefix,
88
} from '@frogpond/storage'
9-
import {AppConfigType} from '@frogpond/app-config'
9+
import {AppConfigEntry} from '@frogpond/app-config'
1010
import type {FilterComboType} from '../views/sis/course-search/lib/format-filter-combo'
1111
import type {CourseType, TermType} from './course-search/types'
1212

@@ -18,13 +18,13 @@ setStoragePrefix('aao:')
1818

1919
const featureFlagsKey = 'app:feature-flag'
2020
export function setFeatureFlag(
21-
name: AppConfigType,
21+
name: AppConfigEntry,
2222
value: boolean,
2323
): Promise<void> {
2424
const key = `${featureFlagsKey}:${name}`
2525
return setItem(key, value)
2626
}
27-
export function getFeatureFlag(name: AppConfigType): Promise<boolean> {
27+
export function getFeatureFlag(name: AppConfigEntry): Promise<boolean> {
2828
const key = `${featureFlagsKey}:${name}`
2929
return getItemAsBoolean(key)
3030
}

0 commit comments

Comments
 (0)