UpdateDialog on InstallScreen
This commit is contained in:
parent
28adb58c69
commit
1d1b124a92
14 changed files with 443 additions and 26 deletions
|
@ -3,6 +3,8 @@
|
|||
|
||||
import type { ThunkAction } from 'redux-thunk';
|
||||
import type { ReadonlyDeep } from 'type-fest';
|
||||
import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions';
|
||||
import { useBoundActions } from '../../hooks/useBoundActions';
|
||||
import * as updateIpc from '../../shims/updateIpc';
|
||||
import { DialogType } from '../../types/Dialogs';
|
||||
import { DAY } from '../../util/durations';
|
||||
|
@ -140,6 +142,10 @@ export const actions = {
|
|||
startUpdate,
|
||||
};
|
||||
|
||||
export const useUpdatesActions = (): BoundActionCreatorsMapObject<
|
||||
typeof actions
|
||||
> => useBoundActions(actions);
|
||||
|
||||
// Reducer
|
||||
|
||||
export function getEmptyState(): UpdatesStateType {
|
||||
|
|
|
@ -8,7 +8,7 @@ import { DialogType } from '../../types/Dialogs';
|
|||
import type { StateType } from '../reducer';
|
||||
import type { UpdatesStateType } from '../ducks/updates';
|
||||
|
||||
const getUpdatesState = (state: Readonly<StateType>): UpdatesStateType =>
|
||||
export const getUpdatesState = (state: Readonly<StateType>): UpdatesStateType =>
|
||||
state.updates;
|
||||
|
||||
export const isUpdateDialogVisible = createSelector(
|
||||
|
|
|
@ -6,6 +6,9 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|||
import { useSelector } from 'react-redux';
|
||||
|
||||
import { getIntl } from '../selectors/user';
|
||||
import { getUpdatesState } from '../selectors/updates';
|
||||
import { useUpdatesActions } from '../ducks/updates';
|
||||
import { hasExpired as hasExpiredSelector } from '../selectors/expiration';
|
||||
|
||||
import * as log from '../../logging/log';
|
||||
import type { Loadable } from '../../util/loadable';
|
||||
|
@ -23,6 +26,7 @@ import { HTTPError } from '../../textsecure/Errors';
|
|||
import { isRecord } from '../../util/isRecord';
|
||||
import * as Errors from '../../types/errors';
|
||||
import { normalizeDeviceName } from '../../util/normalizeDeviceName';
|
||||
import { getName as getOSName } from '../../OS';
|
||||
|
||||
type PropsType = ComponentProps<typeof InstallScreen>;
|
||||
|
||||
|
@ -71,6 +75,9 @@ function getInstallError(err: unknown): InstallError {
|
|||
|
||||
export function SmartInstallScreen(): ReactElement {
|
||||
const i18n = useSelector(getIntl);
|
||||
const updates = useSelector(getUpdatesState);
|
||||
const { startUpdate } = useUpdatesActions();
|
||||
const hasExpired = useSelector(hasExpiredSelector);
|
||||
|
||||
const chooseDeviceNamePromiseWrapperRef = useRef(explodePromise<string>());
|
||||
|
||||
|
@ -246,6 +253,11 @@ export function SmartInstallScreen(): ReactElement {
|
|||
screenSpecificProps: {
|
||||
i18n,
|
||||
provisioningUrl: state.provisioningUrl,
|
||||
hasExpired,
|
||||
updates,
|
||||
currentVersion: window.getVersion(),
|
||||
startUpdate,
|
||||
OS: getOSName(),
|
||||
},
|
||||
};
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue