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

refactor(app, app-shell-odd): update configuration translation #13503

Merged
merged 4 commits into from
Feb 1, 2024
Merged
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
2 changes: 1 addition & 1 deletion app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ dev-shell:

.PHONY: dev-shell-odd
dev-shell-odd: export OT_APP_IS_ON_DEVICE := 1
dev-shell-odd: export OT_APP_ON_DEVICE_DISPLAY_SETTINGS__UNFINISHED_UNBOXING_FLOW_ROUTE := /dashboard
dev-shell-odd: export OT_APP_ON_DEVICE_DISPLAY_SETTINGS__UNFINISHED_UNBOXING_FLOW_ROUTE := 0
dev-shell-odd: export OT_APP_UI__WIDTH := 1024
dev-shell-odd: export OT_APP_UI__HEIGHT := 600
dev-shell-odd:
Expand Down
26 changes: 17 additions & 9 deletions app/src/redux/config/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,22 @@ export const getPinnedProtocolIds: (

export const getOnDeviceDisplaySettings: (
state: State
) => OnDeviceDisplaySettings = createSelector(
getConfig,
config =>
config?.onDeviceDisplaySettings ?? {
sleepMs: config?.onDeviceDisplaySettings?.sleepMs ?? SLEEP_NEVER_MS,
brightness: config?.onDeviceDisplaySettings?.brightness ?? 4,
textSize: config?.onDeviceDisplaySettings?.textSize ?? 1,
) => OnDeviceDisplaySettings = createSelector(getConfig, config => {
if (config?.onDeviceDisplaySettings != null) {
return {
...config.onDeviceDisplaySettings,
unfinishedUnboxingFlowRoute:
config?.onDeviceDisplaySettings.unfinishedUnboxingFlowRoute ?? null,
// @ts-expect-error special casing 0 because there is no null type that gnu make can provide at build time
// see dev-shell-odd in app/Makefile (we provide 0 instead of null)
config.onDeviceDisplaySettings.unfinishedUnboxingFlowRoute !== 0
? config?.onDeviceDisplaySettings.unfinishedUnboxingFlowRoute
: null,
}
)
}
return {
sleepMs: SLEEP_NEVER_MS,
brightness: 4,
textSize: 1,
unfinishedUnboxingFlowRoute: '/welcome',
}
})
Loading